Importance Sampling

importance-samplingmonte-carlosimulationmarginal-likelihoodbayesian-computation

Definition

Importance sampling is a Monte Carlo technique for estimating an expectation Eπ[h(θ)]=h(θ)π(θ)dθE_\pi[h(\theta)] = \int h(\theta)\,\pi(\theta)\,d\theta under a target density π\pi that is hard to sample from, by drawing instead from a tractable proposal (importance) density gg and reweighting each draw by the importance weight w(θ)=π(θ)/g(θ)w(\theta) = \pi(\theta)/g(\theta). The identity h(θ)π(θ)dθ=h(θ)w(θ)g(θ)dθ\int h(\theta)\pi(\theta)\,d\theta = \int h(\theta)\,w(\theta)\,g(\theta)\,d\theta turns an intractable integral into an expectation over gg, so it can be approximated by a weighted average of draws θig\theta_i \sim g. When π\pi is known only up to a normalising constant — the usual case in Bayesian work, where π(θ)f(yθ)p(θ)\pi(\theta)\propto f(y|\theta)\,p(\theta) — the self-normalised estimator h^=iwih(θi)/iwi\hat{h} = \sum_i w_i h(\theta_i) / \sum_i w_i is used, which needs the weights only up to proportionality.

Key Ideas

How It Works

  1. Choose an importance density gg that is easy to sample and approximates π\pi; a common choice is a fat-tailed multivariate tt or a mixture centred at the posterior mode with curvature from the Hessian (a Laplace-type proposal; see Laplace Approximation).
  2. Draw θ1,,θng\theta_1,\dots,\theta_n \sim g.
  3. Form weights wi=π(θi)/g(θi)w_i = \pi(\theta_i)/g(\theta_i) (up to a constant when π\pi is unnormalised).
  4. Estimate Eπ[h]iwih(θi)/iwiE_\pi[h] \approx \sum_i w_i h(\theta_i) / \sum_i w_i.
  5. Assess reliability from the weight distribution; if degenerate, refit gg (heavier tails, better location/scale) or switch to a Markov chain method.

The same machinery estimates a marginal likelihood (normalising constant): m(y)=f(yθ)p(θ)dθ=Eg[f(yθ)p(θ)/g(θ)]m(y) = \int f(y|\theta)p(\theta)\,d\theta = E_g[f(y|\theta)p(\theta)/g(\theta)], the basis of the Gelfand–Dey estimator on the Marginal Data Density. The notorious harmonic-mean estimator is the special case g=g= prior, which is why it is unstable. Sequentially propagating and reweighting draws through a state-space model turns importance sampling into sequential importance sampling / SIR, the ancestor of the particle filter.

Why It Matters

Before Markov chain Monte Carlo became standard, importance sampling was the workhorse for Bayesian integration in econometrics. Early Bayesian VAR posteriors that lacked closed forms — the Normal-Diffuse and Extended Natural Conjugate priors of Kadiyala-Karlsson (1993) Forecasting with Generalized Bayesian Vector Autoregressions — were evaluated by the Kloek–Van Dijk importance sampler, and Kadiyala-Karlsson (1997) Numerical Methods for Estimation and Inference in Bayesian VAR-Models then compared competing importance functions (2-0 poly-tt vs. a mode-centred conditional-tt) against Gibbs sampling, documenting that IS becomes infeasible in large systems while Gibbs stays efficient. Kleibergen-van-Dijk (1993) Non-Stationarity in GARCH Models: A Bayesian Analysis used Bayesian importance sampling to compute posterior odds for GARCH non-stationarity and a unit root in the mean under fat-tailed errors, and Uhlig (1997) Bayesian Vector Autoregressions with Stochastic Volatility used it for the marginal posterior of the VAR coefficients when integrating over latent stochastic-volatility paths. Rao-Blackwellisation of Sampling Schemes shows importance sampling can even be layered onto a Metropolis chain to cut estimator variance by 70–95%, casting doubt on the raw ergodic mean. As a marginal-likelihood tool it is the comparison benchmark against Chib's Gibbs-output method and bridge sampling on the Marginal Data Density. It is a close relative of Metropolis-Hastings Algorithm: both propose from a tractable gg and correct for the mismatch with π\pi — importance sampling reweights every draw, Metropolis-Hastings accepts or rejects.

Open Questions

Related