Hi JAGS forum;
I am running a model that includes a partially observed variable coming from a 0-truncated Poisson distribution. Although the Poisson mean is restricted by its prior to fall between 0 and 100, the model returns values of Infinity for some of the unobserved values (not all). The problem goes away when I also set an upper truncation limit for the Poisson, which I seem to be able to choose as high as I want to (went up to 1mio). Since the mean of the distribution is close to 1, there should be effectively no support for values that high. Is that a reasonable approach to this problem, and any idea what is going wrong without the upper truncation limit?
PS: The problem does not occur with a normal, i.e. not 0-truncated Poisson, so it seems to be some issue with the truncation.
Well that sounds bad but I can't investigate without a reproducible example.
I attached the piece of the model that is causing the problem plus data and R script to this post. I added some observations in the JAGS model description. Thank you for checking this out!
truncpois.txt = JAGS model file
ZeroTruncatedPoissonInf.R = R script
InputData.R = input data
Thanks. JAGS uses inversion to sample the truncated distribution, but this is clearly causing numerical problems in your example. However, your Poisson distribution is only slightly truncated, so it is feasible to use rejection sampling instead. I've modified the development version to use rejection sampling when this is reasonable (i.e. when acceptance probability is >= 0.25) and this gets rid of the Inf values.
The reason that your example is throwing up this problem is that your shape parameter "r" is very small so your Poisson counts are highly over-dispersed.
Thanks so much, Martyn. Looking forward to the new version then. Any idea when this will be out?
Just a quick afterthought on that issue, although one that does not have to do anything with the numerical issues I encountered: It turns out that while the Poisson-Gamma formulation is equivalent to the Negative Binomial, that is likely not the case for the 0-truncated Poisson-Gamma and the 0-truncated Negative Binomial. That occurred to me when I kept getting different results form the two formulations. So the example code I sent is not a correct representation of a 0-truncated negative binomial.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.