using fitdist from fitdistplus with binomial distribution

会有一股神秘感。 提交于 2020-01-02 04:54:06

问题


I just discovered the fitdistrplus package, and I have it up and running with a Poisson distribution, etc.. but I get stuck when trying to use a binomial:

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))

I get the error:

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)

I see a lot of documentation from this package about the negative binomial distribution, but not much about the binomial. This function does appear to support this distribution (though fitdistr in MASS does not).

Any thoughts?


回答1:


Won't you always know the number of trials (i.e., the size parameter)? If so, then try

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

to estimate p and its error.



来源:https://stackoverflow.com/questions/27628529/using-fitdist-from-fitdistplus-with-binomial-distribution

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!