Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Averaging random tries instead of doing hard maths
How big is a lake on a map? Scatter 1000 random dots over the whole map and count the fraction that land in the lake. Fraction × map area ≈ lake area. That’s Monte Carlo: answer a hard averaging question by trying lots of random cases. More dots means a better answer, but slowly: 100 times more dots gives about 10 times more accuracy.
If the lake is tiny, most dots miss it, so you’d be smarter to scatter your dots near the lake and then correct for having cheated. That’s importance sampling.
The probability that two satellites collide, a mission’s chance of running out of fuel, a posterior mean in a Bayesian model, the expected return of a policy: all are integrals solved by sampling. Doing it efficiently is the difference between seconds and days of computation.
- 1. Monte Carlo estimates an average by…
- 2. To get 10× more accuracy you need about…
- 3. Importance sampling deliberately samples…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Plain Monte Carlo
It’s unbiased, with SE (A4.3-4), and the rate doesn’t depend on dimension. Grids cost evaluations. That’s why Monte Carlo rules high-dimensional integration. For Bayesian problems, is the posterior: sample from it (by MCMC, A5.2-7) and average to get means, intervals and predictive draws.
Importance sampling
If sampling is hard, sample and reweight:
This needs wherever (A4.3-1, Radon–Nikodym). For a posterior known only up to a constant, use self-normalized weights . That’s slightly biased but consistent.
- 1. The importance weight is…
- 2. Self-normalized IS is needed when…
- 3. Monte Carlo's error rate depends on dimension…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Effective sample size and choosing q
It’s roughly the number of i.i.d. target samples that the weighted set is worth. The best for is . In practice:
- Match the target’s location and spread (for example, a Laplace approximation: Gaussian at the MAP with the inverse-Hessian covariance).
- Use heavier tails than (Student-t). A proposal narrower than the target gives infinite-variance weights: a few huge weights, and estimates that look precise but are wrong.
- For rare events, centre the proposal on the event, as in the collision example.
In high dimensions, weights degenerate (the ESS collapses) unless is very close to . That’s the motivation for MCMC and sequential Monte Carlo.
Variance-reduction tricks
- Control variates: for a correlated with known mean, using . Variance drops by a factor of .
- Antithetic variates: pair with (or with ). It helps for monotone .
- Stratified sampling: a fixed number of samples per stratum removes the between-strata variance. Latin hypercube sampling extends it to many dimensions.
- Quasi-Monte Carlo: low-discrepancy sequences (Sobol, Halton) reach close to error for smooth integrands.
- 1. ESS of weights (3, 1)?
- 2. A proposal narrower than the target leads to…
- 3. A control variate with correlation ρ reduces the variance by the factor…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Unbiasedness and variance of IS
. So IS is unbiased, with variance . By Cauchy–Schwarz, this is minimized by . For that gives zero variance, because is then constant. You can’t use directly (its normalizer is the answer you’re seeking), but it tells you where to put samples. ∎
The finite-variance condition
requires ’s tails to be at least as heavy as ’s. For a Gaussian target and proposal , the weight variance is finite iff . With a narrower proposal, the weights look fine on most runs, and then occasionally one is astronomically large.
Self-normalized IS: bias and ESS
is a ratio estimator. Its bias is , and its variance is . Kish’s ESS approximates under mild conditions. Pareto-smoothed IS (PSIS) diagnoses heavy-tailed weights by fitting a generalized Pareto distribution to the largest weights (Vehtari et al., 2015).
Exercise 3.1: Show that antithetic sampling helps for monotone f
, with . For monotone , (Chebyshev’s association inequality), so the variance is at most that of 2 independent samples.
- 1. The zero-variance IS proposal is…
- 2. For p = N(0,1), q = N(0, s²), weight variance is finite iff…
- 3. SNIS bias is of order…
Level 4: Expert
★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.Satellite collision probability
At a close approach, the relative position in the encounter plane is Gaussian (from the two orbit covariances), offset by the predicted miss vector. The collision probability is the probability mass inside the combined hard-body disc, here about . Conjunction screening triggers avoidance manoeuvres at thresholds like . Naive Monte Carlo with 20,000 samples sees only about 8 hits, an error of ±35%. Sampling a proposal centred on the disc and reweighting gives ±1.2% from the same samples. Operational tools use Foster’s 2-D integral or Alfano’s series for such cases, and Monte Carlo with importance sampling when the encounter is nonlinear (Alfano, 2005; Chan, 2008).
Monte Carlo in AI, robotics and aerospace
- Policy evaluation and policy gradients are Monte Carlo averages over rollouts. Off-policy evaluation uses importance weights with clipping and doubly robust corrections (Precup, Sutton and Singh, 2000; Jiang and Li, 2016).
- Particle filters are sequential importance sampling with resampling. The ESS triggers resampling (Doucet, de Freitas and Gordon, 2001).
- Rare-event safety validation of autonomous systems uses adaptive importance sampling and the cross-entropy method to find and weight failures (Rubinstein, 1999; O’Kelly et al., 2018).
- Mission dispersion analysis (entry, descent and landing; launch) runs thousands of Monte Carlo trajectories. Latin hypercube and stratified designs reduce the runs needed.
- Variational autoencoders and IWAE use importance-weighted bounds on the marginal likelihood (Burda, Grosse and Salakhutdinov, 2016).
References
- C. Robert, G. Casella (2004). Monte Carlo Statistical Methods, 2nd ed. Springer.
- A. Owen (2013). Monte Carlo Theory, Methods and Examples. Online book (statweb.stanford.edu/~owen/mc).
- L. Kish (1965). Survey Sampling. Wiley (effective sample size).
- A. Vehtari, D. Simpson, A. Gelman, Y. Yao, J. Gabry (2015). “Pareto smoothed importance sampling.” arXiv:1507.02646.
- R. Rubinstein (1999). “The cross-entropy method for combinatorial and continuous optimization.” Methodology and Computing in Applied Probability, 1.
- S. Alfano (2005). “A numerical implementation of spherical object collision probability.” Journal of the Astronautical Sciences, 53(1).
- F. K. Chan (2008). Spacecraft Collision Probability. The Aerospace Press.
- A. Doucet, N. de Freitas, N. Gordon, eds. (2001). Sequential Monte Carlo Methods in Practice. Springer.
- M. O’Kelly, A. Sinha, H. Namkoong, J. Duchi, R. Tedrake (2018). “Scalable end-to-end autonomous vehicle testing via rare-event simulation.” NeurIPS.
- Y. Burda, R. Grosse, R. Salakhutdinov (2016). “Importance weighted autoencoders.” ICLR.