Determining the number of iterations

In simulation, one major question is how many iterations are needed to reach a chosen level of precision in the results.  Simulation as a tool provides an approximation of the actual relationship between the input and output variables.  The precision of the approximation is based on the number of iterations of the simulation done.   More iterations in the sample lead to greater precision.  But the relationship between iterations and precision depends on the relationship between the variables in the precision.  In addition, the analyst must decide which output variable is the variable of interest, and what degree of precision is required.  The next step is to determine a sufficiently large number of iterations R be used to satisfy:

Where Θ-hat is the estimate of the mean, Θ is the actual mean, ε is the specified error, and (1-α) is the probability that the estimate is within ε of the actual value (i.e. the (1-α) confidence interval). Common values of (1-α) are 95% and 99%. The Simulation Report from Gnumeric includes values for the 95% confidence interval as shown in Figure 6-10.

The general procedure is as follows:1

  1. Run simulation for a sample of R0 iterations. The default value in Gnumeric is 1000, set in the options tab of the Simulation menu, Figure 6-6.
  2. Take the sample variance S02 from the simulation output spreadsheet and determine the sample standard deviation S0 (see Figure 6-10).
  3. Using zα/2 as the z-value of the (1-(α/2)) percentile of the standard normal distribution, set the initial estimate of the number of iterations required as the smallest integer R such that
    Iterations required for simulation
    . Note that if R0 is small, it would be more appropriate to use the student's t-distribution of tα/2, R0 instead of zα/2 .

In this example, to estimate the profit to within ε=0.05 , first run the simulation with 1000 iterations and a purchase quantity of 50 results in the following

Mean Variance Confidence (95%)
Demand QUANTITY 59.19 152.4 0.64
Profit QUANTITY 7.85 2.51 0.08

Taking the variance of the table, and setting ε=0.05 and α=0.05 , lookup zα/2 from a standard normal table. zα/2=1.96 so we have

.

Therefore, the minimum number of iterations is 3857.  The simulation can then be re-run with 3857 iterations to create a 95% c.i for profit where ε <=0.05 In this example with 3857 iterations, we get the following Simulation Report table:

Mean Variance Confidence (95%)
Demand QUANTITY 59.11 163.9 0.34
Profit QUANTITY 7.72 2.88 0.04

As expected, the 95% Confidence interval for Profit is less than 0.05. For the newsvendor example, the next step would be to look at the confidence intervals of the profit for all values of purchase quantity, and verify that this confidence interval is adequate for the decision to be made.  

1

Adapted from Banks et. al. Discrete-Event System Simulation, 3rd Edition, pp. 414-416.