Description
The neg_binomial_2_lpmf delegates to poisson_lpmf for large values of the phi parameter. Currently the cutoff is set at phi > 1e5. This introduces discontinuities into the function - I am nut sure whether this is because the cutoff is too optimistic or too pessimistic.
Example
neg_binomial_2_lpmf(181, 13, 1e5 - 1e-8) == -312.05065787932836
neg_binomial_2_lpmf(181, 13, 1e5 + 1e-8) == -312.19077641210203
neg_binomial_2_lpmf(121358, 13, 1e5 - 1e-8) == -933542.7362432084
neg_binomial_2_lpmf(121358, 13, 1e5 + 1e-8) == -988062.09132748179
I've written a failing test for the cutoff at: develop...martinmodrak:bugfix/1496-poisson-phi-cutoff
Expected Output
Values at cutoff - 1e-8 and cutoff + 1e-8 are almost constant, i.e. changes in phi no longer influence the lpmf value and delegating to Poisson is safe.
Current Version:
v3.0.0
Description
The
neg_binomial_2_lpmfdelegates topoisson_lpmffor large values of thephiparameter. Currently the cutoff is set atphi > 1e5. This introduces discontinuities into the function - I am nut sure whether this is because the cutoff is too optimistic or too pessimistic.Example
I've written a failing test for the cutoff at: develop...martinmodrak:bugfix/1496-poisson-phi-cutoff
Expected Output
Values at
cutoff - 1e-8andcutoff + 1e-8are almost constant, i.e. changes inphino longer influence the lpmf value and delegating to Poisson is safe.Current Version:
v3.0.0