Monte Carlo Estimation and Error Analysis
Unbiasedness, the \(1/\sqrt{N}\) standard error, and honest confidence intervals.
Learning Objectives
Click a status chip to cycle: Not started → In progress → Studied → Practiced → Needs review → Mastered.
- Define the Monte Carlo estimator and prove it is unbiased for the target expectation.
- Derive the \(1/\sqrt{N}\) convergence of the standard error and interpret its dimension-independence.
- Construct and interpret a Monte Carlo confidence interval from the sample standard deviation.
- Compute the number of paths needed to reach a target error tolerance.
- Estimate a quantity (e.g. an option price or \(\pi\)) and report it with a valid error bar.
Key Vocabulary
- Monte Carlo estimator
- The sample average \(\hat\theta_N=\tfrac1N\sum_{i=1}^N Y_i\) of i.i.d. draws \(Y_i\) with \(\E[Y_i]=\theta\).
- Unbiasedness
- An estimator with \(\E[\hat\theta_N]=\theta\) for every \(N\); the sample mean is unbiased by linearity of expectation.
- Standard error
- The standard deviation of the estimator, \(\mathrm{SE}=\sigma/\sqrt{N}\), estimated by \(s/\sqrt{N}\).
- Confidence interval
- A random interval \(\hat\theta_N\pm z\,s/\sqrt{N}\) that covers \(\theta\) with the stated probability as \(N\to\infty\).
- Sample standard deviation
- The estimate \(s\) of \(\sigma\) from the data, using the \(N-1\) (Bessel) denominator.
- Root-mean-square error
- The overall accuracy \(\sqrt{\E[(\hat\theta_N-\theta)^2]}\), which for an unbiased estimator equals the standard error.
Intuition & Motivation
The estimator and unbiasedness
Let \(Y_1,\dots,Y_N\) be i.i.d. copies of \(Y\) with \(\theta=\E[Y]\) and \(\sigma^2=\Var(Y)\lt \infty\). The Monte Carlo estimator is the sample mean:
By the strong law of large numbers \(\hat\theta_N\to\theta\) almost surely. Unbiasedness holds for every sample size, not just in the limit - a consequence of linearity of expectation alone.
Variance and the \(1/\sqrt{N}\) standard error
Because the draws are independent, variances add:
Confidence intervals
By the CLT, \(\sqrt N(\hat\theta_N-\theta)/\sigma\Rightarrow\Normal(0,1)\). Replacing the unknown \(\sigma\) by the sample standard deviation \(s\) gives an asymptotic \(100(1-\alpha)\%\) interval:
For 95% take \(z\approx1.96\). Report the estimate with this half-width; a Monte Carlo number without an error bar is not a result.
Interactive: Monte Carlo the Black–Scholes call with an error bar
- Reporting a Monte Carlo estimate with no error bar; without \(s/\sqrt N\) you cannot tell signal from noise.
- Expecting the error to fall like \(1/N\); it falls like \(1/\sqrt N\), so 100× the work buys only 10× the accuracy.
- Using the population denominator \(N\) for \(s^2\) on small samples; use the unbiased \(N-1\) (Bessel) correction.
- Treating the CLT interval as exact for tiny \(N\) or heavy-tailed payoffs; coverage is only asymptotic and degrades when \(\Var(Y)\) is huge or infinite.
- Always print \(\hat\theta_N\pm1.96\,s/\sqrt N\); the half-width tells you when to stop simulating.
- The \(1/\sqrt N\) rate is dimension-free - this is why Monte Carlo, not quadrature, prices high-dimensional baskets.
- If the payoff variance is large, do not just add paths - reach for variance reduction (next lesson) to shrink \(\sigma\) itself.
Practice this in the Euler Lab
Computational problems that exercise exactly this technique. Each opens in the Euler Lab with a Python workbench, a progressive hint ladder, and answer checking. Tier A/B run at full scale in the browser.
Warm-up:
#59 XOR Decryption (4%, tier A) #79 Passcode Derivation (7%, tier A) #102 Triangle Containment (8%, tier A) #54 Poker Hands (9%, tier A)
Applied:
#938 Exhausting a Colour (16%, tier B) #816 Shortest Distance Among Points (17%, tier B) #323 Bitwise-OR Operations on Random In (18%, tier B)
Challenge:
#375 Minimum of Subsequences (41%, tier C) #666 Polymorphic Bacteria (41%, tier C)
124 Project Euler problems in total are mapped to this lesson. Open the Euler Lab to filter them all.
Knowledge Check
Practical Exercise
You run \(N=10^4\) simulations of a discounted payoff and obtain sample mean \(\hat\theta=9.41\) and sample standard deviation \(s=8.0\). (a) Give the standard error and a 95% confidence interval. (b) How many paths would you need to shrink the 95% half-width to \(0.02\)?
(a) \(\mathrm{SE}=8.0/\sqrt{10^4}=8.0/100=0.08\).
95% interval: \(9.41\pm1.96\times0.08=9.41\pm0.157\), i.e. \([9.25,\,9.57]\).
(b) Need \(1.96\cdot8/\sqrt N\le0.02\), so \(\sqrt N\ge1.96\cdot8/0.02=784\) and \(N\ge784^2\approx6.15\times10^5\). Round up to about \(6.2\times10^5\) paths - roughly 62× more work for an 8× tighter bar, the \(1/\sqrt N\) penalty in action.
Lesson Summary
Retrieval Practice
Close the lesson and answer from memory before checking. This is deliberate, effortful recall - the single highest-yield study action.
A: \(\mathrm{SE}=\sigma/\sqrt N\), falling like \(1/\sqrt N\) and independent of the problem’s dimension - quadrupling \(N\) halves the error.
A: \(\hat\theta_N\pm1.96\,s/\sqrt N\), where \(s\) is the sample standard deviation (Bessel \(N-1\) denominator); valid asymptotically by the CLT.
Completion Checklist
- I can explain the core ideas in my own words
- I worked the derivations/examples by hand
- I completed the interactive workbench(es)
- I passed the knowledge check