Home▸Probability & Statistics▸Monte Carlo Importance Sampling (2D)

🎯 Monte Carlo Importance Sampling (2D)

A 2D companion to the 3D importance-sampling lab: watch naive Monte Carlo and importance-sampled estimators race to estimate the rare-tail probability P(X>t) live, sample by sample, and inspect the importance weights that make it work.

Probability & Statistics2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-importance-sampling ↗ Open standalone

This 2D companion runs the same estimators as the 3D original — naive Monte Carlo and a shifted-Gaussian importance sampler — over a live, incrementally-drawn plot instead of a static scene. Each frame draws a batch of samples from p=N(0,1) (naive) and q=N(μ_q,σ_q²) (importance-weighted by w=p/q), so you watch both estimates of the rare-tail probability P(X>t) converge sample by sample, plus a Toggle View mode that plots the sorted importance weights themselves to show weight degeneracy directly.

⚙ Under the hood

A 2D companion to the 3D Monte Carlo Importance Sampling simulation: live incremental sampling compares naive Monte Carlo against a shifted-Gaussian importance sampler estimating P(X>t), with a weight-distribution view exposing degeneracy.

importance samplingmonte carlorare eventsvariance reductionlikelihood ratioeffective sample size

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)