On this page
Say you want the chance that a standard normal variable Z lands above 4. The share of a normal population within 4 standard deviations of the mean is 0.999936657516334, so 6.334 × 10^-5 lies outside (68–95–99.7 rule table, Wikipedia). By symmetry, P(Z > 4) is half of that: about 0.0000317, or roughly 1 in 31,600.
Real rare events, such as a structure failing or a large financial loss, come with no table, so you estimate them by simulation. P(Z > 4) is a good test case because you can check the answer.
Why does plain Monte Carlo need millions of samples for a rare event?
Plain Monte Carlo draws N samples and counts the fraction that land in the event. Tim Brereton's lecture notes, Methods of Monte Carlo Simulation (Ulm University), show that its relative error is √((1 − ℓ)/(Nℓ)), where ℓ is the probability you want. Fix that error at ε and the number of samples grows like 1/(ε²ℓ): the rarer the event, the more samples it takes.
Put in ℓ = 0.0000317. One million normal draws give about 32 values above 4, and a relative error near 18%. Reaching 10% takes about 3.2 million draws; reaching 1% takes about 316 million. Almost every sample lands in the middle of the bell curve and tells you nothing about the tail.
What is importance sampling, and what is the weight formula?
Importance sampling draws from a different density g, one where the event is common, and corrects each sample with a weight. In Brereton's words, the idea is "to reweight the probabilities of certain events happening so that {X ∈ A} (which is the important event) happens much more often" (lecture notes, Chapter 5).
The estimator is the average of w(Xᵢ) · 1{Xᵢ > 4} over N samples Xᵢ drawn from g, with weight w(x) = f(x)/g(x).
The ratio f/g is called the likelihood ratio. It keeps the estimate unbiased, provided g is positive wherever the event can happen under f.
Surya Tokdar and Robert Kass's review, Importance sampling: a review (WIREs Computational Statistics, 2010), calls it "a popular sampling tool used for Monte Carlo computing".
Worked example: how do you estimate P(Z > 4) with a shifted normal?
The numbers below are our own calculation, using the variance formula in Section 5.1 of Brereton's notes.
Pick the proposal. Centre it on the boundary: g = N(4, 1). Now half of your samples land above 4 instead of 3 in 100,000.
Work out the weight. With f(x) = e^(−x²/2)/√(2π) and g(x) = e^(−(x−4)²/2)/√(2π), the √(2π) cancels and w(x) = e^(8 − 4x).
Check one sample. x = 4.3 gives w = e^(−9.2), about 0.0001: under the true f, values like 4.3 are rare.
Average. Draw N values from N(4, 1). Use w(x) for those above 4 and 0 for the rest, then take the mean.
Compare the cost. One weighted sample has variance e^16 · P(Z > 8) − ℓ², about 4.5 × 10^-9. A plain sample has ℓ(1 − ℓ), about 3.2 × 10^-5. That is roughly 7,000 times smaller, so about 450 samples reach the 10% error that plain sampling needed 3.2 million for.
Can importance sampling make the variance worse?
Yes. Brereton opens his chapter by warning that importance sampling's power "comes at a cost (which is that things can go quite wrong)" (lecture notes). His Section 5.1 gives the test: you gain only if the mean likelihood ratio on the event, under f, is below 1. Two ways the P(Z > 4) example fails, by our calculation:
Shift too far. With g = N(10, 1) the weight is e^(50 − 10x). Most samples land far past 4 with tiny weights, but a rare sample near 4 carries a weight near e^10, about 22,000. The variance per sample comes out near 0.21, roughly 6,600 times worse than plain Monte Carlo.
Make it too narrow. With g = N(4, 0.5²), f²/g grows like e^(x² − 16x) as x grows, its integral diverges, and the variance is infinite. Most runs can look fine until one sample deep in the tail throws the estimate off.
The safe rule: keep the proposal's tails at least as heavy as f's over the event, and centre it where the event is most likely to happen.
A checklist before you trust an importance sampling estimate
g is positive everywhere the event can happen.
g's tails are at least as heavy as f's over the event.
No single weight dominates the sum.
You estimated the relative error as the sample standard deviation divided by (√N × mean), and ran several seeds.
The method gives the right answer on a case you can check, such as P(Z > 4).
For densities and likelihood ratios, the Fermi Concept Library has a lesson for every concept in mathematics. To check a derivation like step 2, the Fermi Problem Library has a step-by-step solver that explains the reasoning.



