I have multiple sets of data which conform to overdispersed Poisson distributions which I can model with the alternative parameterization of a negative binomial distribution ($\mu$ and $D$ instead of $p$ and $r$).
I am interested in being able to generate pseudo-random numbers from these distributions but cannot find the ICDF to do so. I also tried to look for how
R did it but it's buried in the
Cpp deep enough that I get lost (not a
How can I convert a psuedo-random uniform number into a pseudo-random negative binomial number with parameters $\mu$=mean and $D$=dispersion?
clarification and thanks
Thank you for the answer and comments pointing me to
rnbinom in R. That in combination with
fitdistr from the
MASS package do exactly what I want. However my interest is in generating these random numbers in SQL Server without leveraging a .NET language.
That being said, I found the stata code interesting, but it's parameterized for $p$ and $r$ and perhaps I'm just very dense, but I'm not sure how to convert my $\mu$ and $D$ back to $p$ and $r$.
All that being said, I have found a JSTOR article that about negative binomial distributions with the specific application as an overdispersed Poisson. I'll see if I can conjure a CDF from there.