Wednesday, July 17, 2013

Calculate the margin of errors and required sample size in a Monte Carlo simulation

Suppose you have a monte carlo simulation, in which a sample of size N is used, each event with K different outcomes (which follows certain probability distribution function) and is independent of each other, given the sample size N is known, and the accuracy of the monte carlo simulation can be estimated using the margin of error which is given by:

margin_of_error = z / (2 * Math.Sqrt(N))

where z is the z-score from normal distribution at a certain confidence level. Typical values of z at different confidence level are given below:

z=1.96 at confidence level 95%
z=2.58 at confidence level 99%
z=3.29 at confidence level 99.9%

Suppose the sample size is N=10000, then at 95% confidence, we can say the margin of error of a monte carlo simulation is:

margin_of_error=1.96 / (2 * Math.Sqrt(10000))

The above equation can also be used to calculate the sample size required if a particular accuracy or margin of error is to be achieved for a monte carlo simulation:

N=(z / (2 * margin_of_error))^2

Further details can be found in:

No comments:

Post a Comment