Understand simulation errorLesson 15 of 76 · 7 min
Calculate Monte Carlo standard error
Estimate numerical uncertainty for a mean from independent simulation draws.
The Monte Carlo standard error, or MCSE, estimates the repeated-simulation standard deviation of an estimator. For a mean of independent identically distributed finite-variance outcomes, use their sample standard deviation divided by the square root of the number of trials.
The sample standard deviation uses ddof=1 to account for estimating the mean. MCSE has the same units as the estimated mean. It is different from a relative error, which divides by an appropriate scale and becomes unstable near zero.
Repeated simulation batches provide an independent check of the formula in a tractable model. Compare the predicted standard error with the observed spread of batch means. This check relies on independent batches; replaying the same seed would make the apparent between-batch spread disappear.
is outcome i; is their sample mean. means add all the indexed outcomes. is sample SD and n is the number of independent trials.
- Independent outcomes
- Estimate a model mean
- Estimate numerical spread
Should the MCSE have squared units or the same units as the outcome?
Write a prediction (optional)
Seeded teaching simulation
Select Run Python below with the code unchanged.
A saved draft is open. To run the published example, open Tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
Your result
Published example output
This result comes from the original Python. Your runs appear above. Build environment ↗
Estimated mean wait (minutes): 5.0204 Estimated MCSE (minutes): 0.1103 Model SE (minutes): 0.1118 SD of independent batch means: 0.1179
Read the first result
The estimated MCSE fluctuates because it uses a finite sample SD. It should be in the same broad range as the independent-batch and model calculations.
Try an edit
Replace n = 2000 with n = 8000. Select Run Python again. Compare Estimated MCSE (minutes), Model SE (minutes) and SD of independent batch means across runs. How close is the observed change to the square-root prediction of half the error?
Scope. A finite estimated MCSE can be misleading for poorly explored tails or infinite-variance outcomes.
Try a fresh case
Your draws come from a slowly moving sequence of dependent draws. Can you automatically use with the raw draw count?
Need a hint?
Hint 1
State the formula’s sampling assumption.
Hint 2
Ask whether a new draw depends on the previous one.