Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在R中拟合负二项分布时的警告_R_Warnings_Binomial Coefficients - Fatal编程技术网

在R中拟合负二项分布时的警告

在R中拟合负二项分布时的警告,r,warnings,binomial-coefficients,R,Warnings,Binomial Coefficients,我试图使用以下代码拟合R中的负二项分布: negfit <- fitdistr(Probhist$DemandQuantity,"negative binomial") coef(negfit) negfit这是我在谷歌上找到的一篇帖子,它表明这也许没什么好担心的:谢谢你提供了方向。我自己做了一些谷歌搜索,但从未登陆过这个链接。看起来一切都很好,系数值是可信的。再次感谢。 Probhist <- data.frame( DemandQuantity=rep( c(0,

我试图使用以下代码拟合R中的负二项分布:

negfit <- fitdistr(Probhist$DemandQuantity,"negative binomial")
coef(negfit)

negfit这是我在谷歌上找到的一篇帖子,它表明这也许没什么好担心的:谢谢你提供了方向。我自己做了一些谷歌搜索,但从未登陆过这个链接。看起来一切都很好,系数值是可信的。再次感谢。
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)
  )
)
> 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