I am trying to set a negative binomial distribution in R using the following code:
negfit <- fitdistr(Probhist$DemandQuantity,"negative binomial")
coef(negfit)
The data is as follows:
Probhist <- data.frame(
DemandQuantity=rep(
c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 17),
c(8632, 2242, 707, 272, 132, 65, 32, 22, 12, 10, 1, 2, 2, 2, 1)
)
)
When I run fitdistr on the data above, I get the following warnings:
> negfit <- fitdistr(Probhist$DemandQuantity,"negative binomial")
Warning messages:
1: In densfun(x, parm[1], parm[2], ...) : NaNs produced
2: In densfun(x, parm[1], parm[2], ...) : NaNs produced
3: In densfun(x, parm[1], parm[2], ...) : NaNs produced
4: In densfun(x, parm[1], parm[2], ...) : NaNs produced
5: In densfun(x, parm[1], parm[2], ...) : NaNs produced
> coef(negfit)
size mu
0.4692958 0.4911798
Despite the warnings, I get odds estimates. I cannot understand if the values โโof the output coefficients are reliable and can be used further. Also, what is the reason for these warnings, and how can I end them? Any help would be greatly appreciated.
Thanks.