### Monte Carlo simulation and Risk Analysis

Monte Carlo simulation is a way to represent and analyze risk and uncertainty. It was called "Monte Carlo" after the famous casino in the Principality of Monaco on the French Riviera established in 1856. Instead of a roulette wheel or cards, Monte Carlo simulation generates random numbers using a (pseudo)random number algorithm. In Monte Carlo simulation, the uncertainty in key input quantities is represented as a probability distribution.

In standard Monte Carlo simulation, software samples a random value from each input distribution and runs the model using those values. After repeating the process a number of times (typically 100 to 10,000), it estimates probability distributions for the uncertain outputs of the model from the random sample of output values. The larger the sample size, the more accurate the estimation of the output distributions.

## The speed of Monte Carlo

A common misconception about Monte Carlo simulation is that the computational effort is combinatorial (exponential) in the number of uncertain inputs -- making it impractical for large models. This is true for simple discrete probability tree (or decision tree) methods. But, in fact, the great advantage of Monte Carlo is that the computation is *linear *in the number of uncertain inputs: It's proportional to the number of input distributions to be sampled.

The sample size you need is controlled by the degree of precision that you want in the output distributions you care about. Suppose you are interested in estimating percentiles of a cumulative distribution, there's no need to increase the sample size just because you have more uncertain inputs. For most models, a few hundred up to a thousand runs are sufficient. You only need a larger sample if you want high precision in your resulting distributions, and a smooth-looking density function. Given the inherent uncertainty in the inputs, higher precision is usually an aesthetic preference rather than a functional need.

## How do you get the input distributions?

Sometimes you can fit a distribution to historical data on the quantity. But often you are trying to forecast using quantities for which you have little or no historical data -- or data only on related quantities. In that case, you may ask an expert on the topic to express his or her best judgment about the quantity in the form of a probability distribution. There is a well-developed method for expert elicitation of this form. If the quantity is important, you may consult several experts and aggregate their opinions. It's usually best to represent these distributions using selected fractiles or the cumulative probability. If the quantity is discrete, or you find it easier to treat it as discrete, you can ask the expert for probabilities of each discrete value. Sometimes it's fine to use a standard parametric distribution, such as a normal, lognormal, uniform, triangular, or beta distribution.

## Latin hypercube sampling

There are variants of Monte Carlo simulation that can be more efficient than simple random sampling -- they converge faster reaching higher accuracy with a smaller sample size. * Latin hypercube sampling (LHS)* divides up each uncertain input into

*n*equiprobable intervals. When generating its

*n*runs, it samples exactly once from each interval. In so doing, it achieves a more uniform sampling over each input distribution than standard Monte Carlo, where the natural randomness usually results in more clumped sampling. For

*random LHS*, it samples at random from each interval, using the underlying distribution, and results are guaranteed to be unbiased. For

**, it uses the median of each of the**

*Median LHS**n*intervals. Median LHS is not

*guaranteed*to be unbiased, but in the vast majority of real applications it is unbiased and it usually converges faster than simple Monte Carlo or random LHS.

## Monte Carlo software

Microsoft Excel and other spreadsheets do not support Monte Carlo simulation directly. But, there are a number of software products that are add-ins to Excel that let you perform Monte Carlo simulation. The best known are Oracle Crystal Ball and Palisade Software's @Risk, which are both excellent products. Lumina designed Analytica from its inception to perform Monte Carlo simulation (and LHS methods); so probabilistic analysis was fully integrated into the product from the start. This gives Analytica's Monte Carlo features certain advantages over spreadsheet add-ins in terms of ease of use and speed of computation. You can define any variable, or any cell in an array, as a discrete or continuous distribution. You can view the probability distribution for any resulting variable as a set of probability bands (selected percentiles), as a probability density function, cumulative distribution function, or even view the underlying random sample.