Skip to content
LeetQuant
QR02 Advanced Probability and Stochastic Processes

QR02 · Advanced Probability and Stochastic Processes · Lesson 2 of 4

Monte Carlo & Variance Reduction

Standard errors, reproducibility, antithetic variates, control variates and importance sampling for rare events.

30 min

The basic estimator

To estimate θ=E[f(X)]\theta = \mathbb{E}[f(X)], draw X1,…,XNX_1, \dots, X_N independently and average:

θ^=1N∑i=1Nf(Xi),SE⁡(θ^)=σfN,\hat\theta = \frac1N\sum_{i=1}^N f(X_i), \qquad \operatorname{SE}(\hat\theta) = \frac{\sigma_f}{\sqrt N} ,

where σf\sigma_f is estimated by the sample standard deviation of the f(Xi)f(X_i). Always report the standard error with a Monte Carlo estimate. The 1/N1/\sqrt N 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 σ=0.2\sigma = 0.2, T=1T = 1 and r=0r = 0, the drift term is −12σ2=−0.02-\tfrac12\sigma^2 = -0.02, so this prices the ATM call; the exact value is about 7.97.)

Variance reduction

  • Antithetic variates. Pair each draw ZZ with −Z-Z and average 12(f(Z)+f(−Z))\tfrac12(f(Z) + f(-Z)). It helps when ff is monotone, because the pair is then negatively correlated.
  • Control variates. Find g(X)g(X) correlated with f(X)f(X) whose mean you know exactly, and use f(X)−β (g(X)−E[g])f(X) - \beta\,(g(X) - \mathbb{E}[g]). The best coefficient is β=Cov⁡(f,g)/Var⁡(g)\beta = \operatorname{Cov}(f, g)/\operatorname{Var}(g), which multiplies the variance by 1−ρ21 - \rho^2. For options, the discounted stock price (whose expectation is S0S_0) is a natural control.
  • Importance sampling. Sample from a different distribution that puts more weight where ff 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 1/N1/\sqrt N for smooth problems.

Worked example

a rare event

You want p=P(Z>4)≈3.17×10−5p = P(Z > 4) \approx 3.17 \times 10^{-5} for a standard normal ZZ with a relative error of 10%. How many plain Monte Carlo samples do you need, and how does importance sampling help?

Show solution

The estimator is a sample proportion with standard error p(1−p)/N\sqrt{p(1-p)/N}, so its relative error is about 1/Np1/\sqrt{Np}. Setting this to 0.10.1 gives N≈100/p≈3.2N \approx 100/p \approx 3.2 million samples, and most of them are wasted.

Instead, sample Y∼N(4,1)Y \sim N(4, 1) and average 1{Y>4} w(Y)\mathbf 1\{Y > 4\}\,w(Y) with likelihood ratio w(y)=φ(y)/φ(y−4)=e−4y+8w(y) = \varphi(y)/\varphi(y - 4) = e^{-4y + 8}. 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).