Re: [R] Negative Binomial: Simulation

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 15 Jul 2006 - 00:21:19 EST

On Fri, 14 Jul 2006, Hadassa Brunschwig wrote:

> Addition to last email:
>
> The problem basically arises also when I want to calculate (plot) the
> cumulative distribution of the negative binomial with the calculated
> parameters mu and theta!
>
> On 7/14/06, Hadassa Brunschwig <dassybr@gmail.com> wrote:
> > 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?

>From ?rnegbin

    size: target for number of successful trials, or dispersion

          parameter (the shape parameter of the gamma mixing
          distribution). Must be strictly positive.

Notice the 'or', and please see also the Details.

> > 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.
> >
> > Hadassa

> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

It does seem to be a question of following the posting guide.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Jul 15 00:27:19 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 15 Jul 2006 - 02:14:58 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.