5 Monte Carlo methods: Inference by sampling: Being a tour guide for unknown Bayesian posteriors
This chapter covers
- Why we need sampling for Bayesian models
- Markov chain Monte Carlo (MCMC)
- The Metropolis–Hastings algorithm
- MCMC best practices
Deriving the posterior distribution of a Bayesian model has been easy so far. This is because our models were built with the right parts—conjugate priors and likelihoods—so that learning from data came easy. We could write out the posterior distribution in closed form and compute the mean, credible intervals (CIs), and other quantities associated with the posterior easily. Unfortunately, real-world Bayesian inference problems aren’t always so simple as to allow conjugate priors.
As soon as our prior doesn’t conform to the (sometimes rigid) structure of conjugate priors, problems arise. We are left with a posterior that we can describe mathematically but can’t work with directly. What do we do in these situations when the math won’t give us an answer? We sample via Monte Carlo (MC) methods.