Articles

Affichage des articles du avril, 2016

Negative binomial and Poisson distributions

Image
It is known that Poisson distribution is a special case of Negative binomial distribution. But how to parametrize NB to make it similar to Poisson in R ? It is simple: rnbinom(n, mu=m, size=+Inf) is similar to rpois(n, lambda=m). Try this to be sure ! layout(mat = 1:2) x1 <- rnbinom(10000, mu=20, size =+Inf) hist(x1, breaks=seq(from=0, to=50, by=2), main="Negative binomial with size=+Inf") y <- rpois(10000, lambda=20) hist(y,  breaks= seq(from=0, to=50, by=2), main="Poisson") Or this: > dnbinom(x = 20, mu=20, size=+Inf) [1] 0.08883532 > dpois(x=20, lambda=20) [1] 0.08883532