Proposition (Metropolis-Hastings)
We wish to sample $X$ with a density $f$ in $\mathcal{X}$.
Let $q(t,s)$ be a Markov kernel density in $\mathcal{X}$ (which is easy to compute), called the proposal kernel density. Given a initial state $X_0\in \mathcal{X}$,
-
draw a proposal $S_n\sim q(X_n, \cdot)$; and
-
take $$ \begin{align*} X_{n+1} := \begin{cases} S_n, &\text{if $A_n=1$}, \\ X_n, &\text{if $A_n = 0$} \end{cases} \end{align*} $$ where $A_n \sim{}$$\op{Bern}$$(a(X_n, S_n))$ and $a$ is the acceptance probability $$ \begin{align*} a(t,s) = \min\left\{1, \frac{f(s) q(s,t)}{f(t) q(t,s)}\right\}. \end{align*} $$
If $f(t) > 0$ and $q(t,s) > 0$ for all $t,s$, then $f$ is the invariant distribution of $(X_n)_{n\geq 0}$.