# 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. – Xi'an May 11 '18 at 9:46

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! – user469216 May 11 '18 at 10:39
• By pi of u' I assume you mean the posterior and not the prior right? – user469216 May 11 '18 at 11:18
• alright, thats what I thought :-) thanks again – user469216 May 11 '18 at 11:21