Steps
for \(i=1,2,\dots,n\)
Sample candidate value \(x^i\) from a proposal distribution \(q(x^i|x^{i-1})\)
Compute acceptance probability:
\[\alpha=\frac{p(x^i)q(x^{i-1}|x^i)}{p(x^{i-1})q(x^i|x^{i-1})}\] 3. Compute \(r=min(1,\alpha)\)
Sample \(U\sim Unif(0,1)\)
\[ x^i=\begin{cases} x^{i-1}, &u<r \\x^i, &u\geq r\end{cases} \]