Markov Chain Monte Carlo (MCMC) is a class of algorithms that generate samples from a target probability distribution by simulating a Markov chain whose stationary distribution is . The samples are correlated, not i.i.d., but long-run averages still converge to expectations under by the ergodic theorem. MCMC solves the core computational problem of Bayesian inference: how to compute posterior expectations, quantiles, and marginal densities when the posterior has no closed form and its normalizing constant is intractable.

The common structure across MCMC algorithms is the detailed-balance construction: propose a move from the current state to a candidate using a proposal distribution , then accept or reject the move to enforce . This single mechanism produces Random Walk Metropolis, Metropolis-Hastings, Gibbs sampling, MALA, and HMC — the difference is entirely in how is chosen and what accept-reject rule implements balance.

Prerequisites

Contents

Shared Concepts

(Acceptance Rate) Fraction of proposals accepted; measures how well the proposal matches the target.

Too-small proposal scales produce high acceptance rates (near ) but tiny moves, yielding strong autocorrelation and slow exploration. Too-large proposal scales produce most moves into low-density regions and few acceptances, yielding a chain that rarely moves. For high-dimensional Gaussian-like targets, theory suggests tuning to roughly ; – is a practical working range.

(Burn-in) Early iterates depend on the starting point and are discarded.

The ergodic theorem guarantees convergence as , but for finite the estimate is biased by the starting point. Standard practice is to discard the first iterates and use only for averages. Initializing at the MLE or MAP (via Newton’s method or the Laplace approximation) minimizes burn-in.

(Trace Plots) Plot each coordinate of against iteration to diagnose mixing.

A well-mixed chain looks like stationary noise around a stable mean. A poorly-mixed chain drifts for many iterations (still in burn-in), stays stuck at constant values (acceptance rate too low), or explores visibly different modes at different times (bimodal target with poor transition).

(Effective Sample Size) Correlated samples carry less information than i.i.d. ones.

If have autocorrelation at lag , the effective sample size is approximately . An MCMC run of iterations with is worth about i.i.d. samples, not . Low is the single most common sign of a poorly-tuned chain.

(Convergence Diagnostics) No single test proves convergence; use multiple chains and visual checks.

The Gelman-Rubin statistic compares within-chain and between-chain variance from multiple independently-initialized chains; is consistent with convergence, is a warning. Running – chains from overdispersed starting points and checking that they overlap in the trace plots is the practical version of this diagnostic.

(Choice of Proposal) Algorithm correctness does not depend on ; efficiency does.

Any proposal that is irreducible with respect to eventually samples from . The engineering challenge is choosing so the chain mixes quickly. A proposal matched to the local curvature of — typically via a Laplace approximation at the MAP — dramatically outperforms isotropic random-walk proposals in high dimensions. Gradient-informed proposals (MALA, HMC) go further by using .

See Also