# Precision Control Functions

Monte Carlo simulation generates output values that are random samples from the (usually unknown) probability distribution of possible outcomes. The primary purpose of Monte Carlo simulation is to determine that probability distribution and associated statistics like the mean and percentiles.

The larger the number of samples used in a Monte Carlo simulation, the more precisely that distribution will be known. ModelRisk’s precision control functions allow the user to ensure that a Monte Carlo simulation has been run with a sufficient number of samples to ensure that a specific level of precision has been achieved.

Each precision control function can be entered into a single cell or as an array function covering two cells. If entered into a single cell, the function returns TRUE when the precision has been reached, or FALSE if it has not. If entered as a two-cell array, the second cell also reports an estimate of the number of additional samples that will be needed to achieve the required precision.

When used in conjunction with VoseSimStop function the user can control the length of a simulation run so that it finishes when the level of precision of statistics for one or more outputs have been achieved. The precision control functions are as follows:

VosePrecisionMean(Cell Reference, Precision, Confidence, Simulation number)

VosePrecisionStdev(Cell Reference, Precision, Confidence, Simulation number)

VosePrecisionPercentile(Cell Reference, Cumulative Probability ,Precision, Confidence, Simulation number)

VosePrecisionProbability(Cell Reference, Value ,Precision, Confidence, Simulation number)

Where the parameters are as follows:

Cell Reference  -  should be a valid reference to a spreadsheet cell

Precision  -  the required level of precision

Confidence -  the required level of confidence that the specified precision has been met. Must lie on (0,1)

Simulation number  -  optional simulation number parameter. Must be an integer >=1. Equals 1 if omitted

Cumulative Probability  -  the required cumulative probability value. Must be on (0,1)

Value  -  the value for which the cumulative probability is required.

## Examples

Imagine that you need to run a single simulation of costs (in \$) in cell A1 so that you know the 99th percentile of your distribution to within an accuracy of \$1000. Since we are dealing with random samples, you can never know for certain that the simulation results are within this level of accuracy, but you can know it with a certain level of confidence, let’s say 95% confident. The applicable precision control function would be:

= VosePrecisionPercentile(A1, 99% ,1000, 95%)

Other examples:

=VosePrecisionMean(A1,0.63,95%) tests whether the distribution of values generated in cell A1 has stabilized sufficiently to be 95% confident that the true mean is known within +/- 0.63.

= VosePrecisionPercentile(A1, 99.9% ,1000, 95%, 2) tests whether the distribution of values generated in Simulation #2 in cell A1 has stabilized sufficiently to be 95% confident that the true 99.9th percentile is known within +/- 1000.

= VosePrecisionProbability(A1, 273 ,1%, 95%) tests whether the distribution of values generated in cell A1 has stabilized sufficiently to be 95% confident that the true ascending cumulative probability of 273 is known within +/- 1%.