Advanced sampling and rare eventsLesson 66 of 76 · 9 min

See a rare event more often

Estimate a rare normal-tail probability with a shifted proposal and correct weights.

Naive Monte Carlo can miss an event whose probability is far smaller than one divided by the trial budget. A zero event count then provides little relative precision. Importance sampling can deliberately visit the rare region more often while correcting the changed sampling distribution.

For a standard normal tail above five, draw instead from a normal distribution centred at five. The event now occurs often under the proposal. Multiply its indicator by the target-to-proposal ratio to estimate the original target probability.

The proposal hit rate is not the target event probability. Report weighted contributions and their MCSE, the proposal definition and an exact reference where available. For other rare events, a poor proposal can give unstable or misleading estimates despite many apparent hits.

1X>5\mathbf1_{X>5} is 1 for a proposal draw above five and 0 otherwise; w(X) is the target-to-proposal density ratio.

More proposal hits are not more target risk
  1. Target event
    P(Z>5),Z∼N(0,1)P(Z>5),\quad Z\sim N(0,1)
  2. Sample nearer the event
    X∼N(5,1)X\sim N(5,1)
  3. Return to the target scale
    p^=mean⁡(1X>5w(X))\widehat p=\operatorname{mean}(\mathbf1_{X>5}w(X))
Reference illustration. The proposal makes rare hits frequent. Correct density-ratio weights restore the target probability; proposal hit rate alone estimates the wrong event distribution.

If half the shifted-proposal draws exceed five, is the standard-normal tail probability one half?

Write a prediction (optional)

Seeded teaching simulation

Select Run Python below with the code unchanged.

Tools
About Python ↗

The code is editable. Press Ctrl+Enter or ⌘+Enter to run Python from the editor.

Published example output

This result comes from the original Python. Your runs appear above. Build environment ↗

Naive target hits: 0 of 30000
Proposal hit fraction: 0.4997
Importance estimate: 2.828881e-07
Estimated MCSE: 3.875393e-09
Exact target tail: 2.866516e-07

Read the first result

The weighted estimate returns to the original target scale. The shifted proposal’s frequent hits only make that target easier to estimate.

Try an edit

Change the last value in n, threshold, shift = 30000, 5, 5 to 3 and run. Then change that last value to 7. Select Run Python again. Compare Proposal hit fraction, Estimated MCSE and the distance from Importance estimate to Exact target tail. Does a higher hit fraction guarantee lower numerical error?

Back to the Python editor

Scope. The normal-tail reference is exact for this model. Rare-event validity in an operational model still depends on its structure and input evidence.

Try a fresh case

Which number estimates the original rare-event probability?

Choose an answer
Need a hint?
Hint 1

Write the target and proposal separately.

Hint 2

Apply the density correction before averaging the indicator.

Your notes