Simulation & uncertainty

Monte Carlo simulation explained

How likely is a project to finish on time when task durations vary? Monte Carlo simulation produces a distribution of possible completion times. The project example explains P80, deadline risk and parallel tasks; the free calculator lets you change the assumptions yourself.

  • 11 min read
  • Updated on
  • smartlytics editorial team

The short answer

Monte Carlo simulation evaluates a model with many randomly drawn inputs to estimate probabilities and percentiles. In project planning, it can show the duration within which 80% of simulated projects finish (P80), conditional on the assumed durations and dependencies.

Simulate a project in the free calculatorFree · in your browser · no sign-up

At a glance

  1. Simulation provides deadline probabilities alongside a planning value: P80 is the duration not exceeded in 80% of simulated project runs.
  2. Simulation error shrinks in proportion to 1/N1/\sqrt{N}: one extra decimal digit of accuracy requires a hundred times as many runs.
  3. Durations, dependencies and rare delays determine how useful the result is. More runs cannot repair a wrong project model.

Some questions have a formula as an answer; many do not. How long will a project take if every task is uncertain and work packages run in parallel? How likely is inventory to last through the month? Monte Carlo simulation answers such questions with a simple recipe: describe uncertain inputs with probability distributions, evaluate the model repeatedly using random draws and analyse the outputs statistically.

In the free Monte Carlo calculator, select “Project planning” to change the five task durations and the deadline. The additional π example makes simulation error visible.

The idea: calculate by trying

Formally, Monte Carlo simulation estimates an expected value. If XX is the random input and ff the model, the difficult expected value E[f(X)]\E[f(X)] is replaced by an average over NN random draws:

E[f(X)]≈μ^N=1N∑i=1Nf(Xi)\E[f(X)] \approx \hat\mu_N = \frac{1}{N} \sum_{i=1}^{N} f(X_i)

That sounds modest but is remarkably general. Probabilities are also expected values: those of indicators that equal 1 when an event occurs and 0 otherwise. Percentiles can be read directly from sorted simulation results.

The method emerged in the 1940s at Los Alamos, where Stanisław Ulam, John von Neumann and Nicholas Metropolis used random experiments on early electronic computers to calculate neutron propagation. The name refers to the Monte Carlo casino; the first publication under that title appeared in 1949 (Metropolis & Ulam 1949).

A first example: estimating π with random points

The classic introductory example estimates the circle constant. Scatter random points uniformly across the unit square and count those landing inside the quarter-circle of radius 1, satisfying x2+y2≤1x^2 + y^2 \le 1. The quarter-circle has area π/4\pi/4, while the square has area 1. The proportion of hits therefore estimates π/4\pi/4, and four times that proportion estimates π\pi:

π^=4⋅hitsN\hat\pi = 4 \cdot \frac{\text{hits}}{N}

Each point is a random trial with hit probability p=π/4≈0,785p = \pi/4 \approx 0{,}785. This directly gives the estimate’s accuracy through its standard error:

SE⁡(π^)=4p (1−p)N\operatorname{SE}(\hat\pi) = 4\sqrt{\frac{p\,(1-p)}{N}}
Points NN Standard error Typical range (± 2 standard errors)
1,000 0.052 3.04 to 3.25
10,000 0.016 3.11 to 3.17
1,000,000 0.0016 3.138 to 3.145

Around 95% of simulation runs fall within two standard errors of the true value. A hundred times as many points therefore gives only ten times the accuracy. This is hopelessly inefficient as a way to calculate π\pi, but it neatly demonstrates how the error of a Monte Carlo estimate behaves.

Interactive

Try Monte Carlo simulation

The interactive explainer estimates π using random points and simulates the project example below. Without JavaScript, the numbers in this article’s tables still apply.

Why it works: large numbers and the 1/√N factor

Two probability theorems underpin the method. The law of large numbers guarantees that the mean μ^N\hat\mu_N approaches the required expected value as NN grows. The central limit theorem additionally describes the error for finite NN: it is approximately normally distributed with standard deviation

SE⁡(μ^N)=σN\operatorname{SE}(\hat\mu_N) = \frac{\sigma}{\sqrt{N}}

Here σ\sigma is the standard deviation of one model evaluation f(X)f(X). It is usually unknown but can be estimated from the same simulation runs. Every Monte Carlo simulation can therefore provide its own error estimate.

Notice what the formula omits: the number of input variables. A grid method sampling ten points in each dimension needs 102010^{20} evaluations for twenty uncertain inputs. The Monte Carlo rate 1/N1/\sqrt{N} holds regardless of dimension. This makes the method particularly useful for models with many uncertain quantities (Robert & Casella 2004; Owen 2013).

A practical example: how long will the project really take?

A team plans a project with five work packages. For each, it estimates three values in working days: minimum, most likely and maximum. These three-point estimates originate in the PERT project-scheduling method (Malcolm et al. 1959). We model each duration with a triangular distribution over those three points. Legal review runs in parallel with implementation and testing.

Work package Minimum Most likely Maximum Mean
Design 3 5 10 6.0
Implementation 10 15 30 18.3
Testing 4 6 12 7.3
Legal review (parallel) 8 12 25 15.0
Approval 1 2 6 3.0

Total duration DD consists of design KK, the longer of the two parallel branches and approval FF:

D=K+max⁡(U+T,  R)+FD = K + \max(U + T,\; R) + F

Here UU denotes implementation, TT testing and RR legal review. Using the most likely values gives 5+max⁡(15+6,12)+2=285 + \max(15 + 6, 12) + 2 = 28 days, exactly how many project plans are made. A simulation with two million runs, independent work packages and a fixed seed paints a different picture:

Metric Result
Plan using most likely values 28 days
Mean 34.7 days
Median (P50) 34.3 days
P80 39.0 days
P90 41.5 days
Probability of finishing within 28 days 7%
Probability of finishing within 30 days 17%

The 28-day plan is met in only about 7% of simulated project runs. There are two reasons.

First, the distributions are skewed. Every work package can take substantially longer than planned but only slightly less time. For each package, the triangular distribution’s mean (a+b+c)/3(a + b + c)/3 is therefore above its most likely value. Because all packages are skewed in the same direction, the deviations add up rather than cancelling out.

Second, parallel branches cause delay. The project waits for the slower branch, and the maximum always satisfies E[max⁡(X,Y)]≥max⁡(E[X],E[Y])\E[\max(X, Y)] \ge \max(\E[X], \E[Y]). This effect is small in our example: legal review is the longer branch in just over 3% of runs; without it, the mean would be 34.66 instead of 34.72 days. The effect changes when branches have similar durations. If legal review had the three-point estimate 15/21/35 days, it would determine the finish in 38% of runs, raising the mean to 36.3 days, even though its mean duration of 23.7 days would remain below the 25.7 days for implementation and testing.

Percentiles instead of point estimates

Simulation’s strength is that it returns an entire distribution. Sorting the simulated total durations gives an S-curve: for every deadline, it shows the probability of finishing by that date. Percentiles can be read from it. A P80 of 39 days means that the project finishes within 39 days in 80% of simulated runs.

For commitments, this language is more honest than a single date. “Median 34 days; an 80% chance of finishing within 39 days” makes risk discussable. Greater certainty requires a buffer or a change to the project. The appropriate deadline depends on the cost of being late, a question for decision theory.

Percentiles also vary between simulations. With 10,000 runs, the standard deviation of the estimated P90 in this example is about 0.1 days; with 1,000 runs, about 0.3 days. The explainer may therefore show slightly different values from the table based on two million runs.

Modelling inputs: distributions and dependencies

The simulation itself is mechanical. The real work lies in its inputs.

  • Choose distributions. Triangular distributions are easy to explain and suit three-point estimates. The PERT distribution, a scaled beta distribution, gives the most likely value more weight and has smoother tails. If data is available, empirical distributions or fitted models are preferable to intuition (Vose 2008).
  • Represent dependencies. Our example assumes independent work packages, a simplification. If implementation and testing are delayed by the same cause, such as an overloaded shared team, their durations are positively correlated. The total-duration distribution then becomes wider with a longer right tail. Shared influencing factors or copulas can represent these relationships.
  • Add rare, large events. A triangular distribution has a fixed maximum. Real risks, such as supplier failure or a fundamental change in requirements, can be modelled as separate events with a probability and an impact.
  • Make calculations reproducible. Computers generate pseudorandom numbers: deterministic sequences that behave statistically like randomness, for example through the Mersenne Twister (Matsumoto & Nishimura 1998). A fixed seed allows a simulation to be reproduced exactly, supporting verification and fair comparisons.

Sensitivity analysis: which assumption matters?

A sensitivity analysis asks which inputs cause the output’s variability. One intuitive measure is the proportion of total-duration variance explained by a single input. The project simulation gives a clear picture:

Input Share of total-duration variance
Implementation About 74%
Testing About 12%
Design About 9%
Approval About 5%
Legal review Less than 1%

To make planning more reliable, first estimate implementation more carefully or split it into smaller packages. Better estimates for legal review would hardly change the outcome unless its duration threatened to become substantially longer.

Greater accuracy with fewer runs

Because error decreases only with 1/N1/\sqrt{N}, reducing the estimate’s variability itself is valuable. Variance reduction methods do exactly that (Glasserman 2003):

  • Antithetic variables use 1−u1 - u alongside each random number uu. If the two halves’ errors partly cancel, variance falls.
  • Common random numbers use the same draws when comparing two alternatives. Random noise then interferes less with their difference, often the most valuable technique for decisions.
  • Importance sampling draws more frequently from rare but decisive regions and corrects for this with weights, allowing small failure probabilities to be estimated efficiently.
  • Quasi-Monte Carlo replaces random numbers with especially uniform point sequences and often converges much faster for smooth problems (Owen 2013).

Monte Carlo in Bayesian statistics

The same logic underlies Markov chain Monte Carlo. The target is a posterior that cannot be sampled directly. A Markov chain generates values whose frequencies approach that posterior; means and intervals are then calculated as in any Monte Carlo simulation. Because successive values are correlated, the effective sample size is smaller than the number of iterations. The Bayesian statistics article explains how the posterior is obtained.

Common mistakes

  1. Invented distributions. Without data or carefully elicited expert estimates, simulation creates only an appearance of certainty.
  2. Ignored dependencies. Independence is the most convenient assumption and often the most dangerous: it makes the output distribution too narrow.
  3. Truncated tails. Distributions with a hard maximum underestimate rare, large delays.
  4. Too few runs and false precision. Extreme percentiles require many runs; report every number at a sensible precision.
  5. Confusing simulation noise with model uncertainty. More runs reduce only simulation error. Assumptions must be checked using data, reviews of earlier projects and sensitivity analyses.

Conclusion

Monte Carlo simulation is one of the most versatile tools in applied mathematics. It needs only a model that can be evaluated with random inputs and returns a full distribution with an error estimate. The project example shows its real value for decisions: it reveals how little a plan based on most likely values says about actual risk. Robert and Casella provide the mathematical foundations (Robert & Casella 2004), while Vose offers extensive practical modelling guidance (Vose 2008).

Frequently asked questions

What is Monte Carlo simulation in one sentence?

A method that estimates an uncertain quantity by evaluating a model many times with random numbers and analysing the results statistically, for example as a mean, probability or percentile.

How many runs does a Monte Carlo simulation need?

It depends on the required accuracy. Standard error decreases with 1/N1/\sqrt{N}. For means and central percentiles, 10,000 runs are often enough; rare events and extreme percentiles need substantially more runs or variance reduction. Always report standard error.

Can I run a Monte Carlo simulation in Excel?

Yes. RAND() and the inverse function of the required distribution can simulate simple models in a spreadsheet. Languages such as Python or R are more convenient for many runs, dependent inputs and reproducible results with a fixed seed.

What is the difference between Monte Carlo and MCMC?

Classical Monte Carlo simulation draws independent random values from known distributions. Markov chain Monte Carlo instead generates a chain of dependent values whose distribution approaches a target that is difficult to sample directly, typically a Bayesian posterior.

Sources and further reading

  1. PaperMetropolis, N. and Ulam, S. (1949): The Monte Carlo Method. Journal of the American Statistical Association 44(247), 335–341.
  2. BookRobert, C. P. and Casella, G. (2004): Monte Carlo Statistical Methods (2nd edition). Springer.The mathematical reference for Monte Carlo methods and MCMC.
  3. BookOwen, A. B. (2013): Monte Carlo theory, methods and examples. Online textbook, Stanford University.Freely accessible textbook with detailed chapters on error estimation, variance reduction and quasi-Monte Carlo.
  4. BookGlasserman, P. (2003): Monte Carlo Methods in Financial Engineering. Springer.An excellent treatment of variance reduction, also valuable outside financial mathematics.
  5. BookVose, D. (2008): Risk Analysis: A Quantitative Guide (3rd edition). Wiley.Practical guidance on distribution choice, expert estimates and dependencies in risk models.
  6. BookSavage, S. L. (2009): The Flaw of Averages: Why We Underestimate Risk in the Face of Uncertainty. Wiley.
  7. PaperMalcolm, D. G., Roseboom, J. H., Clark, C. E. and Fazar, W. (1959): Application of a Technique for Research and Development Program Evaluation. Operations Research 7(5), 646–669.The original PERT paper introducing three-point estimates for task durations.
  8. PaperMatsumoto, M. and Nishimura, T. (1998): Mersenne Twister: A 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Transactions on Modeling and Computer Simulation 8(1), 3–30.

Content last reviewed on 14 November 2026. Please let us know about any errors: impressum@nyxai.com.

From NyxAI

smartlytics is the learning hub of NyxAI GmbH.

Explore the methods we work with, explained openly, with sources and calculations you can reproduce.

Decision Core

NyxAI is developing a Decision Core for Decision Intelligence that combines optimisation, simulation, statistics and reinforcement learning: compare options, make uncertainty visible and learn from outcomes, with people in control.

DeepSquare

Explainable chess AI with human playing styles: NyxAI’s testing ground for understandable decisions under time pressure.