One variable at a time
Metropolis-Hastings proposes moves in all dimensions at once. In high dimensions, finding a good proposal is hard. What if you updated just one variable at a time, holding the others fixed?
The algorithm
To sample from :
- Start at
- For each iteration, update each variable in turn:
- Draw
- Draw
- Draw
- Repeat.
Notice the "Manhattan" movement: each step changes only one coordinate, like navigating a grid city.
Watch it explore
See how Gibbs sampling explores a 2D distribution using axis-aligned moves — alternating horizontal and vertical steps:
Gibbs is a special case of Metropolis-Hastings
Gibbs sampling is Metropolis-Hastings where the proposal is the full conditional distribution. The acceptance probability is always 1 — every proposal is accepted.
When to use Gibbs vs. Metropolis-Hastings
| Gibbs | Metropolis-Hastings | |
|---|---|---|
| Requires | Closed-form conditionals | Only unnormalized target |
| Proposals | Always accepted | Often rejected |
| Movement | Axis-aligned only | Any direction |
| Best for | Conjugate Bayesian models | Arbitrary distributions |
| Weakness | Slow if variables are highly correlated | Tuning the proposal |
When and are strongly correlated, Gibbs sampling slows down. The sampler must zigzag along a narrow diagonal ridge because it can only make axis-aligned moves.
Applications in Bayesian inference
Gibbs sampling powers many Bayesian methods:
- Bayesian linear regression: sample given , then given
- Latent Dirichlet Allocation (LDA): topic models for text
- Mixture models: sample cluster assignments given parameters, then parameters given assignments
- Image segmentation: sample pixel labels given neighbors
Practice problems
Summary
| Concept | Key Idea |
|---|---|
| Gibbs sampling | Update one variable at a time from its full conditional |
| Movement | Axis-aligned ("Manhattan" steps) |
| Acceptance | Always 1 (special case of MH) |
| Requirement | Closed-form conditional distributions |
| Weakness | Slow when variables are highly correlated |
Whenever the conditionals are conjugate (e.g., Normal-Normal, Beta-Binomial), Gibbs sampling gives you MCMC without any proposal tuning.
What's next
We'll shift from discrete-time processes to continuous-time with Poisson processes and how they model random events on a timeline.