Direct simulation of a rare event is an arithmetic problem before it is anything else. To see an event of probability 1/1024 even ten times takes about ten thousand draws, and to estimate it to within ten per cent takes on the order of a hundred thousand. Nine hundred and ninety-nine draws in a thousand return a zero and teach nothing, and the arithmetic gets worse in exact proportion as the event gets more interesting.
Definition · Importance samplingTo estimate E_p[h(X)], draw X₁, …, Xₙ from a different distribution q and report the average of h(Xᵢ)·p(Xᵢ)/q(Xᵢ). The factor p/q is the likelihood ratio or importance weight. q is the proposal.
Theorem · The reweighted estimator is unbiasedIf q(x) > 0 whenever p(x)h(x) ≠ 0, then E_q[h(X)p(X)/q(X)] = E_p[h(X)]. The estimator is therefore unbiased for the same quantity as direct simulation, for every proposal satisfying that condition and for no other.
E_q[h·p/q] = Σ_x q(x)·h(x)p(x)/q(x), summed over the x with q(x) > 0.
The q(x) cancels, leaving Σ h(x)p(x) over those same x. By the support condition every x with h(x)p(x) ≠ 0 is among them, so the sum is Σ_x h(x)p(x) = E_p[h].
The cancellation is also the proof that the condition cannot be relaxed: an x with p(x)h(x) ≠ 0 and q(x) = 0 is a term present in the target sum and absent from the reweighted one, so the estimator is short by exactly that term.
□
The event, and the three proposals
The event on this page is ten fair coins all landing heads. Its probability under p is exactly 1/1024, which is what makes the comparison a measurement rather than a demonstration: both estimators are aiming at a number already known, so any difference between them must be variance. Direct sampling has per-draw variance p(1 − p) = 1023/1048576.
Example · A coin weighted toward headsTake q to be ten coins with P(head) = 4/5. Under q the event has probability 1048576/9765625, about 0.1074 — roughly one draw in nine rather than one in a thousand — and the weight on it is 9765625/1073741824, about 0.0091. The per-draw variance becomes 8717049/1099511627776, about 0.0000079, which is the original variance divided by 32505856/264153 ≈ 123.0569.
Example · The same coin, weighted the wrong wayTake P(head) = 1/5 instead. The event now has probability 1/9765625 under q — about a hundred times rarer than it already was — and the weight on it is 9765625/1024, about 9537. One draw in ten million contributes nine thousand five hundred, and the per-draw variance is 1220703/131072, about 9.31: the original variance multiplied by 295928/31 ≈ 9546.0645.
event: ten heads. p = 1/1024 exactly.
proposal q(event) weight p/q per-draw variance
direct, P(H) = 1/2 1/1024 1 1023/1048576
good, P(H) = 4/5 ≈ 0.1073742 ≈ 0.0090949 ≈ 0.0000079281
bad, P(H) = 1/5 ≈ 0.0000001024 ≈ 9536.743 ≈ 9.313
good: variance DIVIDED by 32505856/264153 ≈ 123.0569
bad: variance MULTIPLIED by 295928/31 ≈ 9546.0645
same estimator, same unbiasedness, four orders of magnitude apart
What the runs look like, which is not what the variances look like
Two thousand draws under the good proposal hit the event two hundred and fifteen times and estimate 0.00097771 against the exact 0.00097656. Two thousand draws under the fair coin hit it once and estimate 1/2000 = 0.0005. Two thousand draws under the bad proposal hit it not at all and estimate exactly 0 — not near the answer, at zero, with a perfectly ordinary-looking trace and nothing on the page to suggest anything went wrong except the variance figure.
That is the failure this lesson leads with. A bad proposal looks fine on a short run because all of the damage is in the spread and none of it is in the picture: the estimate is stable at zero, the running average is a flat line, and the estimator is still unbiased. What is wrong is that one draw in ten million would have carried the entire estimate, and this run did not get it.
The proposal that is refused
Example · A perfectly good distribution that cannot be usedTake the good proposal and remove its mass on ten heads, redistributing it over the other outcomes. The result is a genuine probability distribution — its entries are positive where they are present and they sum to 1 — and the panel refuses it. p puts 1/1024 on the event and q puts nothing there, so the likelihood ratio is undefined exactly where the estimator needs it.
The refusal is the interesting behaviour. An implementation that skipped the undefined outcome would return a number, and the number would be biased low by precisely the term it dropped — which here is the whole of the answer, so it would return zero, every time, with a variance of zero to go with it. A confident, reproducible, perfectly stable wrong answer is the worst thing a simulation can produce, and the only defence is a support check that refuses rather than degrades.
Note what the condition is not about. It is not about q being close to p, and it is not about making the event common; those decide the variance, which is a question of how good the estimator is. The support condition decides whether there is an estimator, which is a prior question with a yes-or-no answer.