urn:lsid:ibm.com:blogs:entries-62407611-5ae9-4120-ab15-a6f61b507bd1Murray Cantor - Tags - random Rational business analytics and optimization03022014-02-16T11:54:30-05:00IBM Connections - Blogsurn:lsid:ibm.com:blogs:entry-8e034de7-6fd5-43a3-81c9-4ea62d90e81bArithmetic with Random Variablesmcantor@us.ibm.com110000CH6XactivefalseComment Entriesapplication/atom+xml;type=entryLikestrue2012-04-08T09:40:31-04:002012-04-09T14:27:32-04:00
<div>This entry is a follow-on to <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/RationalBAO/entry/distributions_explained117?lang=en">my most recent entry</a>. The idea is that random variables are are <b>the</b> <b>way</b> describe the uncertain quantities that arise in managing development efforts. They are a natural extension of the fixed variables we all grew up with. In fact, a fixed variable in a random variable that has probability one of taking a given value and probability zero of taking any other value. In this entry, I explain how you can (with computer assistance) calculate with random variables.<br /></div><div> </div><div>Suppose you want to add two random variables, v1 and v2. This need might arise if you have two serialized tasks in a Gantt chart, each described by a distribution as explain in the previous entry and you would like to know how long it would take to complete both of them, <i>i.e.</i> the sum of their durations. <br /><br />How would you proceed? First note the sum would be another random variable. Therefore what you need is the probability distribution of the sum. There is no formula for that distribution, but there is an effective, commonly used numerical approach, known as Monte Carlo simulation. </div><br />The idea behind Monte Carlo simulation is to use a pseudo random number generator take a sample value of v1 and a sample value of v2 and then add them. <a href="http://en.wikipedia.org/wiki/Monte_Carlo_method">For more detail, follow this link.</a> Note that the values are selected according to the probability distributions of each of the variables. The more likely values are taken more often. Now save that sum and do the same thing many times, say 100,000 times, and store each of the sums. For each of the sums, you can compute its probability by looking at its frequency in the collection of saved sums (some sums are more frequent than others) and divide by the number of samples (actually you have to round the sums to get the counts). What you get is an approximation of the distribution of the sums. <br /><br /><div>Lets look at an example, if v1 has a triangular distribution with L = 3, E = 4, H=7, as shown in Figure 2 and v2 has a triangular distribution with L = 1, E = 6, H= 7 as seen figure 3. </div><div><a '="" href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/RationalBAO/resource/BLOGS_UPLOADED_IMAGES/ScreenShot2012-04-08at9.23.20AM.png" target="_blank"><img alt="image" src="https://dw1.s81c.com/developerworks/mydeveloperworks/blogs/RationalBAO/resource/BLOGS_UPLOADED_IMAGES/ScreenShot2012-04-08at9.23.20AM.png" style=" width:100%; display:block; margin: 1em 1em 0pt 0pt; float: left; position:relative;" /></a> </div><div><a '="" href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/RationalBAO/resource/BLOGS_UPLOADED_IMAGES/ScreenShot2012-04-08at9.23.34AM.png" target="_blank"><img alt="image" src="https://dw1.s81c.com/developerworks/mydeveloperworks/blogs/RationalBAO/resource/BLOGS_UPLOADED_IMAGES/ScreenShot2012-04-08at9.23.34AM.png" style=" width:100%; display:block; margin: 1em 1em 0pt 0pt; float: left; position:relative;" /></a> Figure 2<br /></div><br /><div>The distribution of the sum, found using the Monte Carlo simulator in Focal Point, is given by figure 3. </div><div> </div><div><a '="" href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/RationalBAO/resource/BLOGS_UPLOADED_IMAGES/ScreenShot2012-04-08at9.30.22AM.png" target="_blank"><img alt="image" src="https://dw1.s81c.com/developerworks/mydeveloperworks/blogs/RationalBAO/resource/BLOGS_UPLOADED_IMAGES/ScreenShot2012-04-08at9.30.22AM.png" style=" width:100%; display:block; margin: 1em 1em 0pt 0pt; float: left; position:relative;" /></a> Figure 3</div><div>First note the sum is not another triangular distribution. It is
smoother. This is to be expected from the mathematics of probability. On
the other hand, the distribution of the sum makes sense. For example,
we would expect the most likely value of the sum to be 10, the sum of
the two most likely values, but the simulation found 9.98. The
discrepancy is due to chance and would diminish with more samples. Also
note the probability is zero below 4, the sum of the lows, and above 14,
the sums of the highs. <br /><br />For fun, here is the distribution of the product for the variables: </div><a '="" href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/RationalBAO/resource/BLOGS_UPLOADED_IMAGES/ScreenShot2012-04-08at8.58.08AM.png" target="_blank"><img alt="image" src="https://dw1.s81c.com/developerworks/mydeveloperworks/blogs/RationalBAO/resource/BLOGS_UPLOADED_IMAGES/ScreenShot2012-04-08at8.58.08AM.png" style=" width:100%; display:block; margin: 1em 1em 0pt 0pt; float: left; position:relative;" /></a> <br /><br /><br /><br /><br />The reader can check if this looks sensible. Note also that the product does not have a triangular distribution. The peak is much smoother. <br /><br />So random variables can be used in place of fixed variables in any computation. So they have all of the utility of fixed variables and enable us to express uncertainty. They may seem foreign at first, but they are worth the trouble to learn. Like anything else, they become intuitive after a while.<br /><style>&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;!--
/* Font Definitions */
@font-face
{font-family:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;Cambria Math&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;ヒラギノ角ゴ Pro W3&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
mso-font-charset:78;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-536870145 2059927551 18 0 131085 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;Times New Roman&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
mso-fareast-font-family:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;ヒラギノ角ゴ Pro W3&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
color:black;}
p.Body1, li.Body1, div.Body1
{mso-style-name:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;Body 1&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
mso-style-unhide:no;
mso-style-parent:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
mso-outline-level:1;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:Helvetica;
mso-fareast-font-family:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;ヒラギノ角ゴ Pro W3&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
mso-bidi-font-family:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;Times New Roman&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
color:black;
text-underline:black;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:Cambria;
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;ＭＳ 明朝&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;Times New Roman&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;quot;;
mso-bidi-theme-font:minor-bidi;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
--&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;</style>
This entry is a follow-on to my most recent entry . The idea is that random variables are are the way describe the uncertain quantities that arise in managing development efforts. They are a natural extension of the fixed variables we all grew up with. In...046625urn:lsid:ibm.com:blogs:entry-f65e1cb7-2813-4403-9b82-054e83cffe95Garbage in, Garbage outmcantor@us.ibm.com110000CH6XactivefalseComment Entriesapplication/atom+xml;type=entryLikestrue2011-10-12T09:52:16-04:002011-10-12T09:53:52-04:00
<style>@font-face {
font-family: &amp;quot;ＭＳ 明朝&amp;quot;;
}@font-face {
font-family: &amp;quot;ＭＳ 明朝&amp;quot;;
}@font-face {
font-family: &amp;quot;Cambria&amp;quot;;
}p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: Cambria; }a:link, span.MsoHyperlink { color: blue; text-decoration: underline; }a:visited, span.MsoHyperlinkFollowed { color: purple; text-decoration: underline; }.MsoChpDefault { font-size: 10pt; font-family: Cambria; }div.WordSection1 { page: WordSection1; }</style>
<p class="MsoNormal"> </p>
<p class="MsoNormal">One of the common criticisms of estimation methods is that
the calculation is no better than the assumptions: <i style="">garbage in, garbage out (</i>affectionately known as<i style=""> GIGO). </i>That is, if you make poor or
dishonest assumptions then you will get misleading forecasts. It is especially egregious
that occasionally someone might take advantage of the system by gaming the system
and intentionally feeding assumptions that lead to false forecasts to get a
desired business decision. </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">However, estimation is an essential part of any disciplined
funding decision process (such as program portfolio management). The funding decision
relies on estimates of the costs and benefits. But for reasons just described,
estimation is suspect. <span style=""> </span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">So, what to do? I suggest the answer is not to abandon
estimation; the answer is the not input garbage, or if you do, detect it as
soon as possible to minimize the damage.</p>
<p class="MsoNormal"><span style=""> </span></p>
<p class="MsoNormal">First note that the future costs and benefits are uncertain,
so any serious <span style=""> </span>approach to the GIGO
problem is to treat the assumptions as <a href="http://www.stats.gla.ac.uk/steps/glossary/probability_distributions.html#randvar">random variables</a> with <a href="http://en.wikipedia.org/wiki/Probability_distribution">probability distributions</a> and work from there. Generally, this allows one to use the limited information at hand to enter the assumptions and calculate
the forecasts. <br /></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Douglas Hubbard, in <a href="http://www.howtomeasureanything.com/" style="font-style: italic;">How to Measure Anything</a>, gives us one way to proceed. Briefly, when an uncertain
value is needed, ask the subject matter expert (sme) to give not one but three values:
low, high, and expected. The three values may be used to specify random
variables with triangular distributions [ref].</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">In this case, the greater the difference between the high
and low values, the wider the triangular distribution of the estimate reflecting
the uncertainty of the sme who is honestly making the assumptions. </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">One can use the random variables as values in the estimation
algorithm using Monte<span style=""> </span>Carlo by repeatedly
replacing the single values with sampled values of the triangular distributions
and assembling the distribution of the estimated value. Note the estimate is
again just as good as the assumptions, however we assess our faith in the
estimate by the width of the 10%-90% range of its distribution. </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">For example, one might estimate to the total time for
completing s project by a project by entering, for each task, the least time,
the most time, and the most likely time. Then one could apply Monte Carlo
simulation or more <a href="http://en.wikipedia.org/wiki/Three-point_estimation">or
more elementary methods</a> to rollup the estimates to compute the distribution
of the time to complete.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Hubbard goes further by suggesting that as actuals in the
assumptions come available to review if they fall within the 10% -90% range of
the initial distributions.<span style=""> </span>If they do,
fine. If they don’t, questions are asked about the underlying reasoning and
beliefs. Over time the organization becomes more capable and accountable at
making good assumptions. <span style=""> </span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Further, we can also deal with the garbage in garbage out
problem by using actual data whenever possible. There are at least two techniques.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">In the first, as actuals in the assumptions become available
in the, they can used to replace the distributions. For example if there are
month-by-month sales projections captured as triangular distributions to
forecast sales volumes, the distributions are replaced by the actual sales numbers.<span style=""> </span>Also, one should update the remaining triangular
distributions reflecting the actual sales trends. The resulting estimate will usually
have a narrower distribution.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">A second technique is Bayesian trend analysis. In this case
we use actuals for evidence of the estimate. For example, if a project were on
track, then we can expect that certain measures, such as burn down rate and
test coverage reflect that. If a project were to ship on time, the number
unimplemented requirements would be going to zero, Similarly, the code coverage
measure would be trending towards the target. <span style=""> </span>So these measures are evidence of a healthy
project. <span style=""> </span>Using Bayesian trend analysis, we
can turn the reasoning around and update the initial (prior) estimate of the
time for completion using the actuals as evidence for an improved estimate. The
result is an improved probability distribution of the time to complete the
project. As more actuals become available, the distribution becomes narrower,
increasing the certainty of the forecast.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">This way one can detect early if the system is being gamed
and at the same time, use the actuals to estimate the likelihood of an on-time
delivery. </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">So generally, one can use actuals to not only improve the
estimation process as Hubbard suggests, but also to apply Bayesian techniques,
to improve the estimates of the program variables.<br /></p>
@font-face {
font-family: &amp;quot;ＭＳ 明朝&amp;quot;;
}@font-face {
font-family: &amp;quot;ＭＳ 明朝&amp;quot;;
}@font-face {
font-family: &amp;quot;Cambria&amp;quot;;
}p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0in 0in...004321