Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I need to aggregate multiple estimations, but I haven't been able to find a built-in function in Mathematica that aggregates multiple probablity estimations (I am specially interested in estimations based on the PERTDistribution)

I am being told that I need to:

  1. Compute the standard deviation of each estimation
  2. Compute the square of each task’s standard deviation, which is known as the variance.
  3. Total the variances.
  4. Take the square root of the total.

First of all, is that correct? And if it is, is there a function in Mathematica that can do all that for me? Something like a hypotetical AggregateDistribution that would work like:

AggregateDistribution[PERTDistribution[{min, max}, mode], numberOfEstimatesToAggregate]

Any guidance on a function that provides this or a way to do it would be welcome.

share|improve this question
add comment

3 Answers 3

up vote 6 down vote accepted

A different approach which only traverses the samples once and efficiently wraps each step around the result from the previous stage using ComposeList. It just about falls into the class of one line answers.

sampleSize = 100;
numOfSamples = 10;

ComposeList[{#^2 &, Total, Sqrt}, 
StandardDeviation/@RandomVariate[PERTDistribution[{0, 1}, 0.5],{numOfSamples, sampleSize}]]

Mathematica graphics

share|improve this answer
    
+1 Great solution. I could cut out hundreds of lines of code using ComposeList more regularly. Honestly, I hadn't even become conscious of it until some one used it in another answer on another post a few days back. Sometimes it takes a while for good ideas to sink in -- thanks! –  Jagra Jul 8 '12 at 13:18
    
@Jagra Mathematica has many great ways of doing things.The challenge for me to remember the right one when I want to do something ;) –  image_doctor Jul 9 '12 at 6:21
add comment

If I follow your question, you want to generate a number of samples of data from a PERTDistribution then compute some statistics of those samples. Something like this should work:

sampleSize = 100;
numOfSamples = 10;
data = Table[RandomVariate[PERTDistribution[{0, 1}, 0.5], sampleSize], {i, numOfSamples}];
std = StandardDeviation[#] & /@ data
var = Variance[#] & /@ data
varTotal = Total@var
varTotalSqrt = Sqrt[varTotal]

And as a function incorporating (now both of) Mr. Wizard's suggestions:

sampleSize = 100;
numOfSamples = 10;

aggregateDistribution[sampleSize_, numOfSamples_] := 
 Module[{data, std, var, varTotal, varTotalSqrt},
  data = RandomVariate[PERTDistribution[{0, 1}, 0.5], {sampleSize, numOfSamples}];
  std = StandardDeviation /@ data;
  var = Variance /@ data;
  varTotal = Total@var;
  varTotalSqrt = Sqrt[varTotal];
  {std, var, varTotal, varTotalSqrt}
  ]

aggregateDistribution[sampleSize, numOfSamples] // ColumnForm
share|improve this answer
    
You don't need the Function in StandardDeviation[#] & /@ data and Variance[#] & /@ data ; StandardDeviation /@ data and Variance /@ data will suffice. –  Mr.Wizard Jul 7 '12 at 22:12
    
@Mr.Wizard -- From rough prose to elegant haiku. Nice;-) –  Jagra Jul 7 '12 at 22:34
    
I believe you can replace your Table with: RandomVariate[PERTDistribution[{0, 1}, 0.5], {numOfSamples, sampleSize}] -- but I see image_doctor already shows this form. –  Mr.Wizard Jul 9 '12 at 14:16
    
@Mr.Wizard -- A countess once commissioned a novel. She wanted it in a month. The writer, delivered a completed 1000 page novel on time. The countess loved it. Yet, inside the front cover the author included a note:, "If I had two months more, you would have had 300 pages." Good catch. –  Jagra Jul 9 '12 at 22:23
add comment

I hope that this response is sufficiently different in spirit that it deserves a separate answer.

Mathematica's rich set of functionality extends into direct manipulation of statistical distributions. We can leverage this analytic capability to avoid the need for large numbers of repeated sample trials and work directly with the distributions themselves. This is particularly useful for distributions whose statistical quanities are different from the Normal distribution.

One of which is the Beta family of distributions, of which the PERT is a member.

Using the Mathematica function Variance on a sample drawn from a distribution other than the normal may lead to a false result, this is the case with the PERT.

We can get directly:

dist=PERTDistribution[{0.25, 5}, 1];

{StandardDeviation[dist], Variance[dist]}

{0.79884, 0.638145}

Showing that the standard deviation and variance are related in a very different way from that in the Normal distribution.

I'm not certain what totaling a set of variances from a non Normal distribution and then finding the square root of them is designed to achieve.

share|improve this answer
    
This: my.safaribooksonline.com/0735605351/ch10lev1sec4 (hopefully some of you might have a safari account) –  Luxspes Jul 9 '12 at 14:00
    
It says there: "For a small number of tasks (about 10 or fewer), you can base the best and worst cases on a simple standard deviation calculation" SD = (Worst - Best) /6. If you have more than about 10 tasks, the formula for standard deviation in the previous section isn’t valid, and you have to use a more complicated approach (the one described here, which I might no be explaining right) –  Luxspes Jul 9 '12 at 14:01
    
UCLA's Statistics department had developed some software to explore the Generalized Central Limit Theorem. See: wiki.stat.ucla.edu/socr/index.php/… While normal distributions display the CLT, the GCLT applies to many more. I think the site may even test a beta distribution, but that's an old memory. Still it might prove useful to the OP. –  Jagra Jul 9 '12 at 15:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.