Bayesian MCMC methods let students approximate posterior distributions when direct calculation is difficult or impossible. This cheat sheet summarizes the main ideas behind Markov chains, posterior sampling, Metropolis-Hastings, Gibbs sampling, and convergence checks. It is useful because Bayesian models often produce integrals that cannot be solved by hand, so simulation becomes the practical tool for inference.
Key Facts
- Bayes’ theorem updates prior beliefs using data: .
- The posterior normalizing constant is the marginal likelihood .
- MCMC estimates posterior expectations with sample averages: .
- A Markov chain has transition rule .
- In Metropolis-Hastings, a proposal is accepted with probability .
- For a symmetric proposal , the Metropolis-Hastings acceptance probability reduces to .
- Gibbs sampling updates each parameter from its full conditional distribution, such as .
- Effective sample size adjusts for autocorrelation: .
Vocabulary
- Posterior distribution
- The distribution describing uncertainty about parameters after observing data .
- Prior distribution
- The distribution representing beliefs about parameters before observing the current data.
- Likelihood
- The function that measures how plausible the observed data are for different parameter values.
- Markov chain
- A sequence of random states where the next state depends only on the current state, not the full past history.
- Burn-in
- The early part of an MCMC run often discarded because the chain may not yet represent the target posterior distribution.
- Autocorrelation
- Dependence between MCMC draws at different lags, often measured by correlations such as .
Common Mistakes to Avoid
- Treating MCMC draws as fully independent is wrong because consecutive samples are usually autocorrelated. Use diagnostics and rather than only the raw number of iterations.
- Ignoring burn-in can be wrong because early draws may reflect the starting value more than the posterior. Check trace plots and convergence before summarizing samples.
- Using the wrong Metropolis-Hastings ratio is wrong because proposal densities may not cancel unless the proposal is symmetric. Include and when needed.
- Assuming a high acceptance rate is always good is wrong because tiny proposal steps can accept often but explore slowly. Tune proposals to balance movement and acceptance.
- Relying on one diagnostic alone is wrong because no single statistic proves convergence. Compare trace plots, multiple chains, , autocorrelation, and effective sample size.
Practice Questions
- 1 A Bayesian model has , , and . Compute using Bayes’ theorem.
- 2 In a symmetric Metropolis proposal, the current unnormalized posterior value is and the proposed value is . Find the acceptance probability .
- 3 An MCMC run has draws and autocorrelation sum . Estimate .
- 4 Explain why two chains with similar posterior means may still require trace plots and convergence diagnostics before their results are trusted.