Interactive demo · Bayesian and Probabilistic Machine Learning · Chapter 11

Markov chain Monte Carlo: Metropolis and Gibbs

The target is a correlated Gaussian in two dimensions, drawn as its one- and two-standard-deviation ellipses. Metropolis proposes a step from an isotropic Gaussian of size ρ and accepts it with probability min(1, p(z*)/p(z)) (green moves are accepted, red ones rejected). Gibbs sampling redraws one coordinate at a time from its conditional distribution. Both chains explore by a random walk, so when the target is elongated the number of steps per independent sample grows like (σmax/σmin)2.

Sampler

Proposal size ρ

Gibbs update

α
K

Target correlation r

Run

Lower right panel

Try these

Target: mean (1.5, 1.5), both marginal standard deviations s = 0.529, correlation r, so σmax = s√(1+r) and σmin = s√(1−r). With r = 0.759 this is the target of Figure 11.9, whose drawn ellipse is the two-standard-deviation contour (see the notes). The chain starts at (1, 1) for Metropolis and at (0.8, 0.8) for Gibbs; the random numbers are seeded, so a class sees the same pictures.

In the lecture notes