The Metropolis-Hastings ratio is defined as

$$ \alpha(x'|x) = \min\left(1, \frac{P(x')g(x|x')}{P(x)g(x'|x)}\right) $$

and the state $x'$ is accepted if $u \leq \alpha(x'|x)$, where $u$ is uniformly distributed in $[0,1]$. Given that $u$ can never be larger than $1$, it seems odd to impose the minimum condition on $\alpha(x'|x)$. Is there any logic behind this choice?


One very useful fact of the standard uniform distribution is for any $r \in [0,1]$ $P(u \leq r)= r$ for $u \sim U(0,1)$. We're doing a stochastic hill-climbing procedure which means we have two cases to consider: (1) if it's more likely to move $x\to x'$ than $x'\to x$, i.e. the proposed point is "better", we'll always move there; (2) if $x'$ is not as good, we'll move there with some probability that depends on how "good" it is.

We can make the description of this process simpler by forcing $\alpha(x'|x)\in[0,1]$ so that $\alpha(x'|x)$ itself becomes the probability of accepting.

In general $\alpha(x'|x) \geq 0$ but it does not have to be bounded. But if the proposed point $x'$ is better, as measured by $\frac{P(x')g(x|x')}{P(x)g(x'|x)}\geq 1$, we want to move there with probability $1$. If the proposed point $x'$ is not better we still want a chance to move there, and want to do so with probability $\frac{P(x')g(x|x')}{P(x)g(x'|x)}$. A simple way to do this in one line is $$ \alpha(x'|x) = \begin{cases} 1 & \frac{P(x')g(x|x')}{P(x)g(x'|x)} \geq 1 \\ \frac{P(x')g(x|x')}{P(x)g(x'|x)} & \text{o.w.}\end{cases} = \min\left\{1, \frac{P(x')g(x|x')}{P(x)g(x'|x)}\right\} $$ which makes it so $$ P(\text{move to } x' \text{ from } x) = P(u \leq \alpha(x'|x)) = \alpha(x'|x). $$

  • $\begingroup$ So it's only to keep $\alpha(x'|x)$ bounded and to preserve the property $P(u\leq r) = r$? $\endgroup$ – Frank Vel Jun 11 '18 at 17:45
  • $\begingroup$ @FrankVel yeah, that's my understanding. Also as Neil G points out in his answer, you can determine acceptance or rejection without making $\alpha$ into the actual probability of this happening, but it can simplify things to always have $\alpha$ be the probability instead of $\alpha$ only being the probability if it's less than $1$. So there's nothing "fundamental" about the $\min$, it's just convenient $\endgroup$ – jld Jun 11 '18 at 17:51

$\alpha$ is the acceptance probability. You don't have to clip it in your code since as you point out $u \le \alpha_{\textrm{clipped}}$ iff $u \le \alpha_{\textrm{unclipped}}$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.