# MCMC acceptance formula clarification

Metropolis - Hastings : Data Science Concepts youtube shows the acceptance probability $$A(a \rightarrow b)$$ is $$Max(1, \frac {f(b)}{f(a)})$$.

Is it correct or it should have been $$Min(1, \frac {f(b)}{f(a)})$$?

• A probability larger than one?! What's funny in that the Max gets interpreted as a Min on the final last two lines!!! Commented Dec 9, 2022 at 14:03

## 1 Answer

Yes, indeed. See, e.g., Wikipedia article on Metropolis-Hastings algorithm: $$A(x,x')=\min\left(1,\frac{P(x')}{P(x)}\frac{g(x|x')}{g(x'|x)}\right)$$

In practice one often simply generates a random number in interval $$[0,1]$$ and compares it to the ratio $$P(x')/P(x)$$ (assuming for simplicity that $$g(x|x')=g(x'|x)$$), which automatically takes into account the case when the ration is greater than unity. Yet, it may be useful to consider this case separately, if generating random numbers is costly (when running very long simulations). Thus, in pseudocode below the condition skips the second part (what follows or), if $$P(x')/P(x)>1$$:

if $P(x') > P(x)$ or random_uniform(0,1) < P(x')/P(x):
accept
else
do not accept


Related post