Documentation

CslibFrontier.Probability.MarkovChain.Metropolis

Metropolis chains #

Given a proposal chain Ψ and a target distribution π, the Metropolis chain at x draws a candidate y ~ Ψ x, accepts it with probability min (π y Ψ(y, x) / (π x Ψ(x, y))) 1 and otherwise stays at x ([LP17], Section 3.2.2, (3.4)). For a symmetric proposal the acceptance ratio is π y / π x (Section 3.2.1). Every Metropolis chain is reversible with respect to π, and so has π as a stationary distribution ([LP17], Section 3.2 and Exercise 3.1).

The construction is total. Ratios are computed in ℝ≥0∞, where d / 0 = ⊤ for d ≠ 0 and 0 / 0 = 0. So if π x Ψ(x, y) = 0 the move is always accepted when π y Ψ(y, x) ≠ 0 and always rejected when π y Ψ(y, x) = 0. Either way π x P(x, y) = min (π x Ψ(x, y)) (π y Ψ(y, x)) for x ≠ y. No positivity, irreducibility or symmetry hypothesis is needed for reversibility. The source divides by π x, so it implicitly assumes π is positive; that assumption is not needed here.

Main definitions #

Main results #

References #

A coin showing true with probability min p 1.

noncomputable def Cslib.Probability.MarkovChain.metropolisRatio {S : Type u_1} (Ψ : MarkovChain S) (π : PMF S) (x y : S) :

The Metropolis–Hastings ratio π(y) Ψ(y, x) / (π(x) Ψ(x, y)) for a move from x to y ([LP17], (3.4)); the acceptance probability is its minimum with 1.

noncomputable def Cslib.Probability.MarkovChain.metropolis {S : Type u_1} (Ψ : MarkovChain S) (π : PMF S) :

The Metropolis chain for the proposal chain Ψ and the target distribution π ([LP17], Section 3.2.2): from x, propose y ~ Ψ x, move to y with probability min (metropolisRatio Ψ π x y) 1, and otherwise stay at x.

theorem Cslib.Probability.MarkovChain.metropolis_apply_of_ne {S : Type u_1} (Ψ : MarkovChain S) (π : PMF S) {x y : S} (hxy : x ≠ y) :
((Ψ.metropolis π).step x) y = (Ψ.step x) y * min (Ψ.metropolisRatio π x y) 1

Off the diagonal, the Metropolis chain moves from x to y with probability Ψ(x, y) min (r(x, y)) 1 ([LP17], (3.5)).

The Metropolis chain satisfies detailed balance with respect to its target distribution: π(x) P(x, y) = min (π x Ψ(x, y)) (π y Ψ(y, x)) is symmetric in x and y ([LP17], Section 3.2 and Exercise 3.1).

The target distribution is stationary for the Metropolis chain.

theorem Cslib.Probability.MarkovChain.metropolisRatio_of_symm {S : Type u_1} (Ψ : MarkovChain S) (π : PMF S) {x y : S} (hΨ : (Ψ.step x) y = (Ψ.step y) x) (h0 : (Ψ.step x) y ≠ 0) :
Ψ.metropolisRatio π x y = π y / π x

For a symmetric proposal, the Metropolis ratio of a possible move is π y / π x ([LP17], Section 3.2.1).