01 / 22

Monte Carlo
Estimation

Harness the power of random sampling to estimate integrals, probabilities, and expectations—and learn how variance reduction makes it practical.

Statistics Graduate Level

What Is Monte Carlo Estimation?

Monte Carlo estimation uses random sampling to approximate quantities that may be deterministic but difficult to compute analytically. The core idea: draw \( N \) independent samples \( X_1, X_2, \dots, X_N \) from a distribution, then use a sample average as your estimator.

Flexible
The convergence rate is independent of dimension, avoiding the curse of dimensionality.
Universal
Applies to integrals, expectations, posterior distributions, and optimization.

A Brief History

The method was formalized during the Manhattan Project (1940s) by Stanislaw Ulam and John von Neumann. They needed to simulate neutron diffusion through shielding materials—a problem with too many dimensions for analytical solutions.

Today, Monte Carlo methods underpin Bayesian inference (MCMC), financial derivatives pricing (Black-Scholes simulations), particle physics, and machine learning (stochastic gradient descent, variational inference).

The Big Picture

Unit Square Quarter Circle Estimate Hits inside 12 / 17 Ratio ≈ 0.706 \( \pi/4 \approx 0.785 \) More samples → better

The Fundamental Theorem

The convergence rate is \( O(N^{-1/2}) \) regardless of dimension. By the Central Limit Theorem:

General Expectation Form

More generally, for any distribution \( f(x) \), to estimate \( \theta = \mathbb{E}_f[g(X)] = \int g(x) f(x)\,dx \):

1
Unbiased: \( \mathbb{E}[\hat{\theta}_N] = \theta \) for all \( N \).
2
Consistent: \( \hat{\theta}_N \xrightarrow{p} \theta \) as \( N \to \infty \) by the LLN.
3
Asymptotically Normal: \( \sqrt{N}(\hat{\theta}_N - \theta) \xrightarrow{d} \mathcal{N}(0, \sigma_g^2) \).

Monte Carlo vs Numerical Quadrature

Monte Carlo Quadrature
Convergence rate \( O(N^{-1/2}) \) \( O(N^{-k/d}) \)
Dimension dependence None Exponential (curse)
Smoothness required Only finite variance High regularity (\( C^k \))
Error estimate Built-in (CLT) Requires bounds on derivatives
Best for dimensions \( d \ge 4 \) \( d \le 3 \)

Why Variance Reduction?

The Monte Carlo error is \( \text{SE} = \sigma_g / \sqrt{N} \). To halve the error, you need four times the samples. Variance reduction techniques achieve lower variance per sample, effectively multiplying your computational budget.

Number of Samples (N) Variance Crude MC Variance-reduced Savings

Key Variance Reduction Techniques

Importance Sampling
Sample from a proposal \( q(x) \) that concentrates on regions where \( |g(x)f(x)| \) is large. Re-weight by \( f(x)/q(x) \).
Control Variates
Subtract a correlated function with known mean. Reduces variance by exploiting correlation.
Antithetic Variates
Pair each sample \( U \) with \( 1-U \). Introduces negative correlation to reduce variance.
Stratified Sampling
Partition the domain into strata, sample within each. Eliminates between-strata variance.
Rao-Blackwellization
Analytically integrate out one variable, reducing the MC problem's effective dimension.

How to Apply Monte Carlo

1
Formulate as an expectation: Express the target quantity as \( \theta = \mathbb{E}_f[g(X)] \). Identify the sampling distribution \( f \) and the function \( g \).
2
Generate samples: Draw \( X_1, \dots, X_N \stackrel{\text{iid}}{\sim} f \) using a pseudo-random number generator.
3
Evaluate and average: Compute \( \hat{\theta}_N = \frac{1}{N}\sum g(X_i) \).
4
Estimate the error: Compute \( \hat{\sigma}_g^2 = \frac{1}{N-1}\sum(g(X_i) - \hat{\theta}_N)^2 \) and form a confidence interval.
5
Apply variance reduction (if needed): Choose a technique suited to your problem structure to improve precision.

Example 1: Estimating \( \pi \)

We want to estimate \( \pi \) using the quarter-circle method. The area of the quarter circle of radius 1 inside the unit square is \( \pi/4 \).

1
With \( N = 1{,}000 \): Suppose 789 hits. Then \( \hat{\pi} = 4 \times 789/1000 = \) 3.156.
2
With \( N = 100{,}000 \): typically \( \hat{\pi} \approx 3.141 \pm 0.005 \). The SE is \( \approx \sqrt{p(1-p)/N} \times 4 \approx 0.005 \).
3
Variance: \( \text{Var}(g) = p(1-p) \approx 0.169 \), so \( \text{SE}(\hat{\pi}) = 4\sqrt{0.169/N} \).

Example 2: Estimating \( \int_0^1 e^x \, dx \)

We know the answer analytically: \( e - 1 \approx 1.71828 \). Let's see how Monte Carlo performs.

0 1 1 e \( e^x \) \( x \)

Example 3: Antithetic Variates for \( \int_0^1 e^x \, dx \)

Instead of \( N \) independent draws, pair each \( U_i \) with \( 1 - U_i \). This creates negatively correlated pairs that cancel out variation.

1
Crude MC variance: \( \sigma^2 / N \approx \) 0.2420 / N.
2
Antithetic variance: \( \text{Var}\left(\frac{e^U + e^{1-U}}{2}\right) \approx \) 0.0039. That is a 98% reduction!
3
Why it works: \( e^x \) is monotone, so \( \text{Cov}(e^U, e^{1-U}) < 0 \). The pair averages near \( (e-1) \) almost perfectly.

Importance Sampling in Detail

Optimal \( q^* \)
The zero-variance proposal is \( q^*(x) \propto |g(x)| f(x) \). In practice, we approximate this.
Danger: heavy tails
If \( q \) has lighter tails than \( f \cdot g \), weights explode and variance becomes infinite.

Control Variates Method

1
Still unbiased: \( \mathbb{E}[\hat{\theta}_{\text{CV}}] = \theta \) since \( \mathbb{E}[h(X) - \mu_h] = 0 \).
2
Optimal \( c^* \): \( c^* = \text{Cov}(g,h) / \text{Var}(h) \). This minimizes \( \text{Var}(\hat{\theta}_{\text{CV}}) \).
3
Variance reduction: \( \text{Var}(\hat{\theta}_{\text{CV}}) = \sigma_g^2(1 - \rho_{g,h}^2)/N \), where \( \rho_{g,h} \) is the correlation.

Common Mistakes

✕ Too few samples
Using \( N = 100 \) and trusting the result. The CLT needs \( N \) large enough for the normal approximation to hold—check \( \hat{\sigma} \) first.
✕ Ignoring infinite variance
If \( \text{Var}(g(X)) = \infty \), the standard MC estimator may not converge at rate \(N^{-1/2}\). The CLT fails.
✕ Bad importance proposal
Choosing \( q \) with lighter tails than \( gf \) creates extreme weights. A few samples dominate, giving garbage estimates.
✕ Confusing SE with Var
Reporting \(\frac{\hat{\sigma}^2}{N}\) as the error instead of \(\frac{\hat{\sigma}}{\sqrt{N}}\). Always report the standard error, not the variance of the mean.
✕ Correlated samples
Using MCMC output directly as "iid samples." MCMC produces correlated draws—you must account for autocorrelation when computing SE.

Summary of VR Techniques

Technique Mechanism Typical Reduction
Antithetic Variates Negative correlation via \( U, 1-U \) 50–99%
Control Variates Subtract correlated known-mean Up to \( \rho^2 \times 100\% \)
Importance Sampling Re-weight under better \( q \) Arbitrary (if \( q \) is good)
Stratified Sampling Partition domain, sample each Removes between-strata var
Rao-Blackwellization Analytically integrate one variable Always improves (by Rao-Blackwell thm)

Question 1 of 5

The standard Monte Carlo estimator \( \hat{\theta}_N = \frac{1}{N}\sum g(X_i) \) has a convergence rate of:

Question 2 of 5

To halve the standard error of a Monte Carlo estimate, you need to multiply the sample size by:

Question 3 of 5

In the antithetic variates method, pairing \( U \) with \( 1 - U \) works because:

Question 4 of 5

In importance sampling, the optimal zero-variance proposal \( q^*(x) \) is proportional to:

Question 5 of 5

Which statement about Monte Carlo vs. deterministic quadrature is correct?