I am trying to fit the negative binomial ditribution in R using the following code:
negfit <- fitdistr(Probhist$DemandQuantity,"negative binomial")
coef(negfit)
Data looks as below:
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 the fitdistr on above data, I get 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
In spite of the warnings, I do get the coefficient estimates. I am not able to understand if the output coeff values are trustworthy and can be used further. Also, what is the reason behind these warnings and how can I do away with them? Any help would be greatly appreciated.
Thanks.