r > zero(r) error using NegativeBinomial #1789
-
Hi all, I just wanted to raise a weird issue I have been having when using Turing. Apologies if this is not the right place to discuss this or if I am doing something obviously wrong. I should also note I am new to Turing but really like how you adapted my COVID model a while back. I'd like to do more development using it. Long story short, using Julia 1.7.2, i have a very simple distribution fitting problem. However, despite r being exponential and positive, and p being beta and between {0,1}, I get a weird error from the NegativeBinomial -
I have tried changing the prior on r (e.g to inverse gamma) but this does not help. The input, data, is simply a matrix of integers. code block below
some more error stack
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
HMC samplers rely on bijective transforms to handle constrained variables (e.g. |
Beta Was this translation helpful? Give feedback.
HMC samplers rely on bijective transforms to handle constrained variables (e.g.
r
). If the mass of the constrained variable is close to the boundary, then these transforms might suffer from numerical issues (e.g. violating the support). In the example above, one potential cause is that the prior overr
has most of its mass close to zero. A simple solution to these problems is using a less informative prior, e.g.Exponential(0.5)
.