twolodzko / extraDistr

Additional univariate and multivariate distributions
51 stars 11 forks source link

Remove implicit integer constraint on size parameter for beta-negative binomial #14

Closed willtownes closed 6 years ago

willtownes commented 6 years ago

When trying to compute the PMF of beta-negative binomial with non-integer size ("r") parameter, a value of NaN is returned. For example:

dbnbinom(0,size=2.001,alpha=1.5,beta=2)

Looking at the source code, the NaN is produced programmatically (not due to numerical overflow or underflow) whenever r is not an integer. Since the r parameter can take on any positive real value, this restricts evaluation of the PMF function to a subset of the true parameter space.

I suggest either changing the documentation to reflect that the function only works for integer "r" (aka "size"), or remove the !isInteger(r, false) checking from the logpmf_bnbinom function.