I am struggling with convergence criteria when performing a Monte carlo simulation on a uniform distribution. Any help would be much appreciated !

Say I want to sample uniformly a 1D interval (for the sake of simplicity).

I use a random number generator (in Fortran) to draw X values between 0 and 1. Then, how do i choose the number of points N such that I have a good sampling?

I know the expected mean ( = 0.5) and I can easily compute the average of the positions of my MC points, i.e. μ = (X_1 +... + X_N) / N. I was thinking that I could define a simple criterion such that: μ / < 1% for instance, in order to decide if N is large enough or not...

Please can anyone tell me if there is a better way to figure this out?

Thanks a lot !


You may not be able to determine the exact number of points required to obtain 1% error, but you can estimate the order of magnitude of points needed to obtain this accuracy.

Monte Carlo converges at a rate $O(\frac{1}{\sqrt{N}})$, where $N$ is the sample size. This means the absolute error is bounded as $|\mu-\mu_{approx}|<\frac{C}{\sqrt{N}}$, where C is some constant. Roughly speaking, this means for every additional digit of accuracy, you will need 100 times more points. Since you need two digits of accuracy to obtain 1% accuracy (i.e. because 1% is equivalent to 0.01), you will somewhere on the order of $100*100=10^5$ points. This estimate is not a guarantee that you will obtain 1% accuracy with exactly $10^5$ points because we don't know the constant C. This constant depends on the properties of the function you are sampling and its order of magnitude may not be estimatable.


I have not come across an "explicit" formulation which can define the optimum number of samples for MC simulation.

Typically, a good way would be to estimate the variance of simulation with each sample size, $n$, as $\sigma^2_n$. Then the standard error for $n$ samples would be $\frac{\sigma_n}{\sqrt{n}}$. You could repeat the error estimates by increasing your sample size and stop at that sample size for which the error hits a certain threshold.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.