The basic estimator
To estimate , draw independently and average:
where is estimated by the sample standard deviation of the . Always report the standard error with a Monte Carlo estimate. The rate is slow: each extra digit of accuracy costs 100 times as many samples. That is why variance reduction matters.
import numpy as np
rng = np.random.default_rng(42) # seeded: reproducible
z = rng.standard_normal(1_000_000)
payoff = np.maximum(100 * np.exp(-0.02 + 0.2 * z) - 100, 0.0)
est, se = payoff.mean(), payoff.std(ddof=1) / np.sqrt(z.size)
(With , and , the drift term is , so this prices the ATM call; the exact value is about 7.97.)
Variance reduction
- Antithetic variates. Pair each draw with and average . It helps when is monotone, because the pair is then negatively correlated.
- Control variates. Find correlated with whose mean you know exactly, and use . The best coefficient is , which multiplies the variance by . For options, the discounted stock price (whose expectation is ) is a natural control.
- Importance sampling. Sample from a different distribution that puts more weight where matters, and reweight by the likelihood ratio. Essential for rare events.
- Stratification and quasi-random numbers. Spread samples evenly rather than randomly; this can beat for smooth problems.
Worked example
a rare event
You want for a standard normal with a relative error of 10%. How many plain Monte Carlo samples do you need, and how does importance sampling help?
Show solutionHide solution
The estimator is a sample proportion with standard error , so its relative error is about . Setting this to gives million samples, and most of them are wasted.
Instead, sample and average with likelihood ratio . Now half the samples land in the region of interest, and a few thousand samples give the same accuracy.
Knowledge check
A Monte Carlo estimate has standard error 0.01 with N samples. How many samples bring it to 0.001?
Knowledge check
A control variate has correlation 0.9 with your estimator's payoff. With the optimal coefficient, by what factor does variance fall?
Knowledge check
Why seed the random number generator in research code?
Practice problems
Finished reading?
Answer the 3 knowledge checks to complete this lesson (0 done).