使用来自fitdistplus的fitdist和二项式分布 [英] using fitdist from fitdistplus with binomial distribution

查看:188
本文介绍了使用来自fitdistplus的fitdist和二项式分布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现了 fitdistrplus 软件包,并且已经将其安装并使用Poisson发行版等运行。但是在尝试使用二项式时遇到了困难:

  set.seed(20)
#二项式分布,平均分数为2
scorebinom <-rbinom (n = 40,size = 8,prob = .25)


fitBinom = fitdist(data = scorebinom,dist = binom,start = list(size = 8,prob =均值(scorebinom)/ 8))

我收到错误:

  fitdist中的错误(data = scorebinom,dist = binom,start = list(size = 8,:
函数mle无法估计参数,
,错误代码为100
此外:有50个或更多警告(使用warnings()查看前50个)

我从这个软件包中看到了很多关于负二项式分布的文档,但是关于二项式分布的信息并不多。该函数的确支持了这种分布(尽管 fitdist r MASS 中不会)。



有什么想法吗?

解决方案

您是否不总是知道试用次数(即size参数)?如果是这样,则尝试

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

来估计p及其误差。 / p>

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?

解决方案

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.

这篇关于使用来自fitdistplus的fitdist和二项式分布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆