Calculating the expected number of zeros under Poisson and Negative Binomial distributions in R

假装没事ソ 提交于 2019-12-11 10:39:30

问题


I know the maths, but how to calculate the expected number of zeros under Poisson and Negative Binomial distributions in R? Is there any function to do so?


回答1:


You say you know the mathematics, in which case you already know you're calculating n p(0), right?

You already know n.

So isn't your question "How do I evaluate p(0) = P(X=0) for a Poisson or negative binomial in R?"

Try

?Poisson

and

?NegBinomial

And you will see there's a dpois function for the Poisson, and a similar one for the negative binomial.

So n*dpois(0,lambda) (with whatever value you need in place of lambda) would give the expected number of zeros from a given Poisson distribution. The negative binomial calculation works similarly.



来源:https://stackoverflow.com/questions/22288824/calculating-the-expected-number-of-zeros-under-poisson-and-negative-binomial-dis

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