MCMC Basics
Summary
Chapter 11 of BDA3 introduces Markov chain Monte Carlo — the workhorse of Bayesian computation. MCMC constructs a Markov chain whose stationary distribution is the posterior, enabling sampling from complex, high-dimensional posteriors.
Gibbs Sampler
Iteratively sample each parameter from its full conditional distribution:
- Requires known conditional distributions (often available for conjugate models)
- Each step updates one parameter block, cycling through all blocks
- Can be slow when parameters are highly correlated
Metropolis-Hastings Algorithm
More general: propose a move and accept with probability:
- Random walk Metropolis: — simple but can be slow in high dimensions
- Optimal acceptance rate: ~0.44 in 1D, ~0.23 in high dimensions
Convergence Diagnostics
- statistic: compare between-chain and within-chain variance across parallel chains. indicates approximate convergence
- Effective sample size : accounts for autocorrelation in the chain
- Run multiple chains from dispersed starting points
- Discard warmup/burn-in iterations
See Also
- Introduction to Bayesian Computation — simpler methods for easier problems
- Efficient MCMC — HMC and NUTS, the modern standard
- Computational Troubleshooting — when MCMC goes wrong
- Fitting and Validating Computation — workflow context: how long to run, fake-data checks
- Bayesian Workflow - Overview — MCMC as one step in the full iterative cycle
- Hierarchical Models — the primary use case where MCMC is indispensable