Effective Sample Size in MCMC
MCMC draws are correlated with each other, so 10,000 samples from a chain carry less real information than 10,000 independent draws — effective sample size measures how many independent draws they're actually worth.
When you draw samples from a Markov chain to approximate a posterior distribution, each new draw depends on the one before it — the chain moves in small steps, so neighboring samples tend to look alike. That correlation means a chain of 10,000 draws does not tell you as much as 10,000 truly independent draws would. Effective sample size (ESS) answers the practical question: how many independent samples would give you the same precision as this correlated chain?
ESS is computed from the chain's autocorrelation at increasing lags. Roughly, , where is the number of draws and is the correlation between samples steps apart. A chain that mixes fast — jumping around the posterior with little memory of where it just was — has autocorrelations that die off quickly, so the sum stays small and ESS is close to . A slow, "sticky" chain has autocorrelations that decay slowly, and ESS can be a small fraction of , sometimes under 1%.
Worked example. A sampler runs 5,000 iterations for a parameter of interest, and the lag-sum in the formula above works out to 4 (i.e. ). That gives — the chain behaves, for estimation purposes, like 1,000 independent draws rather than 5,000.
Effective sample size, not raw draw count, is the real currency of an MCMC run — a longer chain with poor mixing can carry less information than a shorter one that explores the posterior efficiently, so ESS (and ESS per second of compute) is what you should check before trusting a posterior summary.
Related concepts
Practice in interviews
Further reading
- Gelman et al., Bayesian Data Analysis (ch. 11)