Bounded target support

[This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Here is an interesting question from Tomàs that echoes a lot of related emails:

I’m turning to you for advice. I’m facing problem  where parameter space is bounded, e.g. all parameters have to be positive.
If in MCMC as proposal distribution I use normal distribution, then at some iterations I get negative proposals. So my question is: should I use recalculation of acceptance probability every time I reject the proposal (something like in delayed rejection method), or I have to use another proposal (like lognormal, trancated normal, etc.)?

It is indeed a popular belief that something needs to be done to counteract restricted supports. However, there is no mathematical reason for doing so! Consider the following illustration

target=function(x) (x>0)*(x<1)*dnorm(x,mean=4)
mcmc=rep(0.5,10^5)
for (t in 2:10^5){
prop=mcmc[t-1]+rnorm(1,.1)
if (runif(1)<target(prop)/target(mcmc[t-1]))
mcmc[t]=prop
else
mcmc[t]=mcmc[t-1]
}
hist(mcmc,prob=TRUE,col="wheat",border=FALSE,main="",xlab="")
curve(dnorm(x-4)/(pnorm(-3)-pnorm(-4)),add=TRUE,col="sienna",lwd=2)

and the following outcome, with a perfect fit!


Filed under: Books, R, Statistics, University life Tagged: Monte Carlo Statistical Methods

To leave a comment for the author, please follow the link and comment on their blog: Xi'an's Og » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)