Diagnosing MCMC Convergence
What you'll learn: How to tell when your Markov Chain Monte Carlo samples are trustworthy and ready to use for inference.
Why Convergence Matters
After running MCMC algorithms like Metropolis-Hastings or Gibbs Sampling, you need to verify that your chains have converged to the true posterior distribution. Think of it like waiting for stirred coffee to settle—you need to know when the mixing is complete before taking a representative sample.
Core Diagnostic Tools
Trace Plots
Visual plots of parameter values across iterations. A well-converged chain looks like a "fuzzy caterpillar"—stable oscillation around a central value without long-term trends or getting stuck.
Autocorrelation
Measures how correlated consecutive samples are. High autocorrelation means samples are redundant (like taking photos every millisecond). You want low autocorrelation, indicating independent samples.
Effective Sample Size (ESS)
Adjusts your raw sample count for autocorrelation. If you ran 10,000 iterations but high autocorrelation exists, your ESS might only be 500—meaning you have far fewer "truly independent" samples than you think.
Gelman-Rubin Diagnostic (R̂)
Runs multiple chains from different starting points. If they all converge to the same distribution, the between-chain variance should match within-chain variance. R̂ ≈ 1.0 (typically < 1.1) indicates convergence; higher values mean chains haven't mixed properly.
When to Worry
- Trace plots showing trends or drift
- High autocorrelation that won't decrease
- ESS much smaller than iteration count
- R̂ > 1.1 across chains
Key Takeaway: Always diagnose MCMC convergence using multiple tools—trace plots, autocorrelation, ESS, and Gelman-Rubin statistics—before trusting your posterior samples for inference.