Tutorials › Generalized Linear Models › Mean–Size Parameterization of Negative-Binomial Counts

Negative-Binomial and Beta-Binomial · Tutorial 718 of 981

Mean–Size Parameterization of Negative-Binomial Counts

Learn to read, calculate with, and convert between the mean–size and success-probability forms of the negative-binomial distribution.

Advanced 12 min read

What You'll Learn

  • Define the negative-binomial count distribution using its mean and size parameters.
  • Derive its probability mass function from a Poisson–Gamma mixture.
  • Obtain its mean and variance using conditional expectation and variance.
  • Convert between mean–size parameters and the success-probability convention.
  • Calculate probabilities and match parameters from specified moments.
  • Avoid confusing the size parameter with a count or a probability.

Why Use Mean and Size?

A negative-binomial count model can be written using a success probability and a number of successes, but in many applications the expected count is the quantity of direct interest. A mean–size parameterization puts that expected count in the model explicitly. It also makes the source and amount of extra variation visible: at a fixed mean, the size controls the additional variance beyond the mean.

The size parameter is not the number of observations, and it need not be an integer. The probability model is defined for every positive real size. When the size is an integer, the success-probability form also has a familiar interpretation in terms of counting failures before a specified number of successes.

Definition: A count \(Y\) has a negative-binomial distribution with mean parameter \(\mu>0\) and size parameter \(r>0\) if its support is \(y=0,1,2,\ldots\) and $$ P(Y=y)=\frac{\Gamma(y+r)}{\Gamma(r)y!} \left(\frac{r}{r+\mu}\right)^r \left(\frac{\mu}{r+\mu}\right)^y. $$ Here \(\Gamma\) is the gamma function, which satisfies \(\Gamma(m)=(m-1)!\) for positive integers \(m\). The parameters are called “mean” and “size” because \(E[Y]=\mu\) and the size \(r\) controls the variance, as shown below.

For integer \(r\), the coefficient \(\Gamma(y+r)/(\Gamma(r)y!)\) is the usual binomial coefficient \(\binom{y+r-1}{y}\). For noninteger \(r\), the gamma-function expression extends the probability formula beyond that counting interpretation. The parameters \(\mu\) and \(r\) must both be positive; the probability mass function assigns probability to nonnegative integer counts.

Deriving the Probability Mass Function

The Poisson–Gamma mixture gives a direct derivation. Let the latent Poisson rate be \(\Lambda\), with a gamma distribution having shape \(r\) and rate \(\beta=r/\mu\). Conditional on \(\Lambda=\lambda\), let \(Y\) have a Poisson distribution with rate \(\lambda\). This gamma distribution has mean \(r/\beta=\mu\). Its density for \(\lambda>0\) is

$$ f_{\Lambda}(\lambda)=\frac{\beta^r}{\Gamma(r)}\lambda^{r-1}e^{-\beta\lambda}, \qquad \beta=\frac{r}{\mu}. $$

To find the unconditional probability of a count \(y\), integrate the conditional Poisson mass against this density. The integrand is nonnegative, and the gamma integral is finite for \(y+r>0\), so the calculation is valid for every \(y=0,1,2,\ldots\) and \(r>0\).

Derivation: Using \(P(Y=y\mid\Lambda=\lambda)=e^{-\lambda}\lambda^y/y!\),
$$ \begin{aligned} P(Y=y) &=\int_0^\infty \frac{e^{-\lambda}\lambda^y}{y!} \frac{\beta^r}{\Gamma(r)}\lambda^{r-1}e^{-\beta\lambda}\,d\lambda\\ &=\frac{\beta^r}{\Gamma(r)y!} \int_0^\infty \lambda^{y+r-1}e^{-(\beta+1)\lambda}\,d\lambda\\ &=\frac{\Gamma(y+r)}{\Gamma(r)y!} \frac{\beta^r}{(\beta+1)^{y+r}}\\ &=\frac{\Gamma(y+r)}{\Gamma(r)y!} \left(\frac{r}{r+\mu}\right)^r \left(\frac{\mu}{r+\mu}\right)^y. \end{aligned} $$
The third line uses \(\int_0^\infty x^{a-1}e^{-cx}\,dx=\Gamma(a)/c^a\) for \(a>0\) and \(c>0\). Substituting \(\beta=r/\mu\) gives the last line. This is the stated mean–size probability mass function.

Worked Example: Calculating Probabilities From Mean and Size

Suppose \(Y\) has mean \(\mu=12\) and size \(r=3\). Find its probability of zero and its probability of exactly two counts, then calculate its variance.

First compute the two probability factors: $$ \frac{r}{r+\mu}=\frac{3}{15}=0.2, \qquad \frac{\mu}{r+\mu}=\frac{12}{15}=0.8. $$ For zero counts, the gamma-function coefficient is 1, so $$ P(Y=0)=0.2^3=0.008. $$ For two counts, \(\Gamma(5)/(\Gamma(3)2!)=24/(2\cdot2)=6\). Therefore $$ P(Y=2)=6(0.2)^3(0.8)^2 =6(0.008)(0.64) =0.03072. $$ The variance is \(12+12^2/3=12+48=60\). Thus the model has mean 12 and variance 60, while the requested point probabilities are 0.008 and 0.03072.

Mean and Variance

The mixture representation also supplies the moments without summing an infinite series. The gamma rate and shape above give \(E[\Lambda]=\mu\) and \(\operatorname{Var}(\Lambda)=r/\beta^2=\mu^2/r\). Conditional on \(\Lambda\), a Poisson variable has both conditional mean and conditional variance equal to \(\Lambda\).

Theorem: If \(Y\) has the mean–size negative-binomial distribution with \(\mu>0\) and \(r>0\), then $$ E[Y]=\mu, \qquad \operatorname{Var}(Y)=\mu+\frac{\mu^2}{r}. $$

Proof. The mixing distribution has a finite second moment because it is gamma with positive shape and rate. The conditional Poisson distribution has finite mean and variance for every finite \(\Lambda\), and the unconditional moments below are finite. The law of total expectation therefore gives

$$ E[Y]=E\{E[Y\mid\Lambda]\}=E[\Lambda]=\mu. $$

For variance, apply the law of total variance:

$$ \begin{aligned} \operatorname{Var}(Y) &=E\{\operatorname{Var}(Y\mid\Lambda)\} +\operatorname{Var}\{E[Y\mid\Lambda]\}\\ &=E[\Lambda]+\operatorname{Var}(\Lambda)\\ &=\mu+\frac{\mu^2}{r}. \end{aligned} $$

The first term is the variation present in a Poisson count conditional on its rate. The second term is the additional variation associated with the random rate. Since \(\mu^2/r>0\), the variance exceeds the mean for finite positive \(\mu\) and \(r\). At a fixed mean, increasing \(r\) decreases this additional term. \(\square\)

Worked Example: Finding Size From a Mean and Variance

Suppose a negative-binomial count has mean 8 and variance 24. Find its size and its success-probability parameters, then calculate \(P(Y=1)\).

The variance equation gives \(24=8+8^2/r\), so $$ r=\frac{8^2}{24-8}=\frac{64}{16}=4. $$ The success probability is \(p=1/3\), as derived in the next section. The probability of one count is $$ P(Y=1) =\frac{\Gamma(5)}{\Gamma(4)1!} \left(\frac{1}{3}\right)^4\left(\frac{2}{3}\right) =4\cdot\frac{1}{81}\cdot\frac{2}{3} =\frac{8}{243}. $$ Checking the moments, the mean is \(4(2/3)/(1/3)=8\), and the variance is \(4(2/3)/(1/3)^2=24\). Both match the specified values.

Mapping to the Success-Probability Form

One common convention defines a negative-binomial count as the number of failures before \(r\) successes, where each trial has success probability \(p\). Under this convention, the probability mass function is \(\binom{y+r-1}{y}p^r(1-p)^y\) when \(r\) is an integer. For real \(r>0\), replace the binomial coefficient by its gamma-function expression. This convention matters: software and references can use different meanings for the probability parameter, so check which event that parameter describes.

Parameter mapping: In the failures-before-\(r\)-successes convention, the mean–size and success-probability parameters are related by $$ p=\frac{r}{r+\mu}, \qquad 1-p=\frac{\mu}{r+\mu}, \qquad \mu=\frac{r(1-p)}{p}. $$ The domains are \(\mu>0,\ r>0\) and \(0<p<1,\ r>0\). In this convention, \(r\) is unchanged by the conversion.

To verify the mapping, substitute \(p=r/(r+\mu)\) into \(p^r(1-p)^y\). Since \(1-p=\mu/(r+\mu)\), this product is exactly the pair of factors in the mean–size probability mass function. Conversely, solving \(p=r/(r+\mu)\) for \(\mu\) gives \(\mu=r(1-p)/p\). The conversion is one-to-one for fixed positive \(r\): every \(\mu>0\) gives a \(p\) strictly between 0 and 1, and every such \(p\) gives a positive \(\mu\). Substituting into the moment formulas also gives

$$ E[Y]=\frac{r(1-p)}{p}, \qquad \operatorname{Var}(Y)=\frac{r(1-p)}{p^2}. $$

Worked Example: Converting From Success Probability

Let \(r=5\) and \(p=0.4\), with \(Y\) counting failures before five successes. Find the mean–size parameters, the variance, and the probability of zero failures.

The size remains 5. The mean is $$ \mu=\frac{r(1-p)}{p} =\frac{5(0.6)}{0.4} =7.5. $$ The corresponding mean–size probability factors are \(r/(r+\mu)=5/12.5=0.4\) and \(\mu/(r+\mu)=7.5/12.5=0.6\), agreeing with \(p\) and \(1-p\). The variance is $$ \operatorname{Var}(Y)=\frac{5(0.6)}{0.4^2} =\frac{3}{0.16} =18.75. $$ For zero failures, the coefficient is 1 and the factor \((1-p)^y\) is 1, so \(P(Y=0)=p^r=0.4^5=0.01024\).

Common Mistakes and a Practical Check

A frequent error is to treat the size as the mean, or to substitute the success probability for the mean. They are different parameters: \(r\) controls the size of the gamma mixing distribution, while \(\mu\) is the unconditional expected count. In the success-probability convention, the probability \(p\) is the probability of a success, not the probability of a failure. For example, with \(r=5\) and \(p=0.4\), the mean is \(7.5\), not \(5\), \(0.4\), or \(5(0.4)\).

A reliable check is to translate parameters in both directions and verify the mean. Given \((\mu,r)\), calculate \(p=r/(r+\mu)\). Given \((p,r)\), calculate \(\mu=r(1-p)/p\). Then verify that the two factors in the mass function are \(p\) and \(1-p\) in the correct order. Confusing them can produce a different distribution even if the size is correct.

The mean–size form is useful when an expected count is the natural quantity to specify or interpret. Its variance formula also makes clear how the size affects spread at a fixed mean. For integer \(r\), the success-probability form may be more immediately interpretable as a sequence of trials; for noninteger \(r\), the gamma-function extension remains a valid count distribution even though that literal trial-count interpretation no longer applies.

Check Your Understanding

Use the mean–size definition and the failures-before-successes convention stated above.

  1. For \(\mu=6\) and \(r=2\), calculate the two probability factors and \(P(Y=0)\).
  2. Show how the variance changes when \(r\) is doubled while \(\mu\) is held fixed.
  3. For \(r=4\) and \(p=0.25\), find the mean, variance, and probability of zero counts.
  4. A negative-binomial count has mean 10 and variance 35. Find its size.
  5. Explain why a noninteger size is allowed in the mean–size probability mass function, even though it cannot count a whole number of required successes.
Clinical Biostats