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.


3 Answers 3


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

  • $\begingroup$ +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! $\endgroup$
    – Jagra
    Jul 8, 2012 at 13:18
  • $\begingroup$ @Jagra Mathematica has many great ways of doing things.The challenge for me to remember the right one when I want to do something ;) $\endgroup$ Jul 9, 2012 at 6:21

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
  • $\begingroup$ You don't need the Function in StandardDeviation[#] & /@ data and Variance[#] & /@ data ; StandardDeviation /@ data and Variance /@ data will suffice. $\endgroup$
    – Mr.Wizard
    Jul 7, 2012 at 22:12
  • $\begingroup$ @Mr.Wizard -- From rough prose to elegant haiku. Nice;-) $\endgroup$
    – Jagra
    Jul 7, 2012 at 22:34
  • $\begingroup$ 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. $\endgroup$
    – Mr.Wizard
    Jul 9, 2012 at 14:16
  • $\begingroup$ @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. $\endgroup$
    – Jagra
    Jul 9, 2012 at 22:23

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.

  • $\begingroup$ This: my.safaribooksonline.com/0735605351/ch10lev1sec4 (hopefully some of you might have a safari account) $\endgroup$
    – Luxspes
    Jul 9, 2012 at 14:00
  • $\begingroup$ 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) $\endgroup$
    – Luxspes
    Jul 9, 2012 at 14:01
  • $\begingroup$ 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. $\endgroup$
    – Jagra
    Jul 9, 2012 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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