使用fitdistplus的fitdist和二项分布

emu*_*rak 5 r distribution

我刚刚发现了这个fitdistrplus软件包,我把它和Poisson发行版一起运行等等.但是在尝试使用二项式时我遇到了问题:

set.seed(20)
#Binomial distributed, mean score of 2
scorebinom <- rbinom(n=40,size=8,prob=.25)


fitBinom=fitdist(data=scorebinom, dist="binom", start=list(size=8, prob=mean(scorebinom)/8))
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Error in fitdist(data = scorebinom, dist = "binom", start = list(size = 8,  : 
  the function mle failed to estimate the parameters, 
                with the error code 100
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Run Code Online (Sandbox Code Playgroud)

我从这个包中看到了很多关于负二项分布的文档,但关于二项式并不多.这个功能确实出现了支持这种分布(虽然fitdistrMASS没有).

有什么想法吗?

小智 6

你不会总是知道试验次数(即尺寸参数)吗?如果是这样,那就试试吧

fitBinom=fitdist(data=scorebinom, dist="binom", fix.arg=list(size=8), start=list(prob=0.3))
Run Code Online (Sandbox Code Playgroud)

估计p及其误差.

  • 谢谢!那奏效了。当我提供它作为起始值时,它无法估计大小参数对我来说似乎很奇怪,但我认为在固定参数列表中需要它是有道理的。我认为 `fitdist` 文档在这里可以更明确。 (2认同)