[R] Theta from negative binomial regression and power_NegativeBinomiial from PASSED

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Fri Sep 15 16:02:39 CEST 2023

    Yes, theta is the 'size' or overdispersion parameter.  Sometimes 
also denoted as k. Wikipedia discusses this parameterization in the 
paragraph starting "In negative binomial regression ..." (but they call 
this parameter r rather than theta or k).

   You can also see this in MASS on google books:


   This parameterization was added to R in version 1.3.0 ...

On 2023-09-15 2:27 a.m., Ivan Krylov wrote:
> On Fri, 15 Sep 2023 01:51:27 +0000
> "Sorkin, John" <jsorkin using som.umaryland.edu> wrote:
>> What is theta, and how does it relate to the parameters of the
>> negative binomial distribution?
> Plugging the p (the success probability) and the r (the number of
> successes until the experiment is stopped) from the Wikipedia article
> (where they are defined in terms of mean mu and variance sigma^2)
> together with the variance from ?MASS::rnegbin (where it's defined as
> mu + mu^2/theta) into Maxima and then solving for theta, I get:
> solve(
>   [
>    p = mu / sigma^2,
>    r = mu^2/(sigma^2-mu),
>    sigma^2 = mu + mu^2/theta
>   ],
>   [mu, sigma, theta]
> );
> [
>   mu = ((1-p)*r)/p,
>   sigma = sqrt(r-p*r)/p,
>   theta = r
> ]
> That is, the theta from MASS seems to be equivalent to the number of
> successes from the formulation in the Wikipedia article.

Dr. Benjamin Bolker
Professor, Mathematics & Statistics and Biology, McMaster University
Director, School of Computational Science and Engineering
(Acting) Graduate chair, Mathematics & Statistics
 > E-mail is sent at my convenience; I don't expect replies outside of 
working hours.

More information about the R-help mailing list