# Metropolis-Hastings acceptance ratio for truncated proposal

I have a proposal distribution for one parameter theta_guess

theta_guess = guessleft(theta_accept(1,r-1), 0.01,0)


which is a left truncated normal (and thus non-symmetric) with inputs and output given by:

[guess]=guessleft(mu,sigma,a)


where mu is the mean, sigma is the std. deviation and a is the lower bound. Moreover, theta_accept(1,r-1) is last period's accepted theta because r is the iteration counter and theta_accept is a 1 x R vector (where R is the number of iterations to run in the M-H loop).

I want to create a correction factor for the acceptance ratio. I am not sure however how to do it. I've tried:

c=truncated_normal_a(theta_guess,theta_accept(1,r-1), 0.01,0)/...
truncated_normal_a(theta_accept(1,r-1),theta_guess, 0.01,0)


which is of course one. My problem is that I have two parameters, mu and sigma. sigma is fixed, but mu is not in the proposal since it depends on the last period's accepted parameter. So I have no idea what to put in mu's place when creating my correction factor.

• The ratio of the truncated normal is not one because of the normalising constants. Commented May 11, 2018 at 9:46
• It's strange to ask for a truncated proposal distribution, instead of limiting the estimated parameter to be non-negative(e.g. weight, height). If the new proposed parameter is always higher than the current value, the sampling space is very much dependent on the initial value and might not converge or only find a local mode. Commented Jun 12, 2020 at 13:50

If a Metropolis-Hastings algorithm uses a truncated Normal as proposal$${\cal N}^+(\mu_{t-1},\sigma^2)$$the associated Metropolis-Hastings acceptance ratio is $$\dfrac{\pi(\mu')}{\pi(\mu_{t-1})}\times \dfrac{\varphi(\{\mu_{t-1}-\mu'\}/\sigma)}{\varphi(\{\mu'-\mu_{t-1}\}/\sigma)}\times\dfrac{\Phi(\mu_{t-1}/\sigma)}{\Phi(\mu'/\sigma)}$$when $\mu'\sim{\cal N}^+(\mu_{t-1},\sigma^2)$ is the proposed value and $\pi$ denotes the target of the simulation (e.g., the posterior distribution). This ratio simplifies into $$\dfrac{\pi(\mu')}{\pi(\mu_{t-1})}\times \dfrac{\Phi(\mu_{t-1}/\sigma)}{\Phi(\mu'/\sigma)}$$hence the truncation impacts the Metropolis-Hastings acceptance ratio.

Note that there are several X validated posts on the issue of simulating positive parameters using Metropolis-Hastings, like this one.

Here is an illustration for the target density $$\pi(\mu)\propto\exp\{-(\log \mu -1)^2\}\,\exp\{-(\log \mu -3)^4/4\}$$ when using $\sigma=.1$ as the scale in the truncated Normal:

targ=function(mu){1/exp((log(mu)-1)^2+log(mu)-3)^4/4}
mumc=rep(pi,1e4)
for (t in 2:1e4){
prop=mumc[t-1]+.1*qnorm(pnorm(-mumc[t-1]/.1)+
runif(1)*pnorm(mumc[t-1]/.1))
mumc[t]=prop+(runif(1)>targ(prop)*pnorm(mumc[t-1]/.1)/
targ(mumc[t-1])/pnorm(prop/.1))*(mumc[t-1]-prop)}


• I saw the cross-post but couldn't implement given that knowledge :-) Thanks for your detailed answer! Commented May 11, 2018 at 10:39
• By pi of u' I assume you mean the posterior and not the prior right? Commented May 11, 2018 at 11:18
• alright, thats what I thought :-) thanks again Commented May 11, 2018 at 11:21
• Technically, this MH algorithm would be not theoretical exact, right, due to the approximation in pnorm? Commented Apr 18 at 13:24
• @Greenparker: the level of approximation in pnorm is so low that it does not matter for all practical purposes. Commented Apr 18 at 13:47