Metropolis–Hastings algorithm (source code)

= Metropolis–Hastings algorithm
{c}
{wiki}

The Metropolis–Hastings algorithm proposes $y$ from $q(x,\mathord\cdot)$ at state $x$ and accepts it with probability
$$
1\wedge\frac{\pi(y)q(y,x)}{\pi(x)q(x,y)}.
$$
This acceptance rule enforces <detailed balance> with the target density $\pi$.