The negative binomial distribution need not be restricted to integer values of the argument n; cf.
Indeed, the noninteger case as an overdispersed generalization of the Poisson distribution is important in many fields, including ecology, environmental monitoring, epidemiology, industrial safety, insurance, medicine, microbiology, etc.
Here are function definitions for the general negative binomial pdf and cdf
pdf_negative_binomial2(x,n,p) := pdf_beta(p,n,x+1)*p/(n+x)$ /* negative binomial for real n>0 */
cdf_negative_binomial2(x,n,p) := cdf_beta(p,n,x+1)$ /* negative binomial for real n>0 */
The functions for mean, var, std, skewness, and kurtosis should be fine if you just remove the trap for non-integer n. Assuming that the quantile function numerically inverts the cdf, then it would likely be fine too.
Log in to post a comment.