[R] Negative Binomial: Simulation

Hadassa Brunschwig dassybr at gmail.com
Fri Jul 14 15:15:40 CEST 2006

Hi R-Users!

(sorry about the last email)
I fitted a negative binomial distribution to my count data using the
function glm.nb() and obtained the calculated parameters
theta (dispersion) and mu.

I would like to simulate values from this negative binomial distribution.
Looking at the function rnbinom() I was looking at the relationship
between the two possible parametrizations of the negative binomial and found
that for this fuction I must use:

prob = theta/(theta+mu)     and       size = theta

Theta, however, is not an integer. So how can size (which is the number of
successes) equal theta?

I know there is a function rnegbin which does what I want. I would still
like to raise the above question (probably a more statistical one
than R).

Thanks a lot for any comments.


More information about the R-help mailing list