From a Random Rate to a Count Distribution
A Poisson model assumes that its rate is fixed. In some settings, however, different observational units have different underlying rates, even after accounting for measured covariates. A useful model represents that heterogeneity by making the Poisson rate random. When the random rate has a gamma distribution, integrating it out produces a negative-binomial count distribution.
The derivation matters for more than recognizing a familiar name. It specifies exactly which negative-binomial parameterization is being used and shows how rate variation changes the mean and variance. In particular, a random rate adds variability beyond the Poisson variance.
Deriving the Negative-Binomial Mass Function
For each nonnegative integer \(k\), the unconditional probability is obtained by integrating the conditional Poisson probability over all possible rates. The gamma density contributes a factor \(e^{-\beta\lambda}\), while the Poisson probability contributes \(e^{-\lambda}\); these combine to give the rate \(\beta+1\) inside the integral.
To verify the formula, start from the mixture integral:
The integral is finite because \(\alpha+k>0\) and \(\beta+1>0\). Substituting \(t=(\beta+1)\lambda\) gives
Thus the mass function above follows. It is a probability distribution: summing the masses over \(k\geq 0\) gives the binomial series \((1-q)^{-\alpha}\), with \(q=1/(\beta+1)<1\), multiplied by \((\beta/(\beta+1))^\alpha=(1-q)^\alpha\), so the sum is one.
Under the stated negative-binomial convention, the mass function with parameters \(r>0\) and \(0<p<1\) is
Matching terms gives \(r=\alpha\), \(p=\beta/(\beta+1)\), and \(1-p=1/(\beta+1)\). The gamma rate is therefore \(\beta=p/(1-p)\). If a gamma distribution is instead specified by a scale, that scale is \(1/\beta\), not \(\beta\).
Worked Example: A Gamma Rate of 2
Suppose \(\Lambda\sim\operatorname{Gamma}(3,2)\) in the shape-rate convention and \(X\mid\Lambda\sim\operatorname{Poisson}(\Lambda)\). Find the marginal distribution and calculate \(P(X=2)\), the mean, and the variance.
Here \(\alpha=3\) and \(\beta=2\). The negative-binomial parameters are \(r=3\) and \(p=2/(2+1)=2/3\), so \(1-p=1/3\). For \(k=2\),
The mean and variance, derived below, are
The variance exceeds the mean by \(3/4\), reflecting the variability of the random rate.
Probability-Generating Function and Moments
The probability-generating function gives another compact description of the mixture and makes its moment structure visible. For \(0\leq z\leq 1\), conditional expectation gives \(E[z^X\mid\Lambda]=e^{\Lambda(z-1)}\). Integrating this expression against the gamma density yields
The integral is finite on this range because \(\beta+1-z\geq\beta>0\). The expression is also differentiable in an open interval containing \(z=1\), since \(\beta>0\). Thus its derivatives at \(1\) give ordinary factorial moments.
Here is a direct proof of the mean and variance. The gamma density gives \(E[\Lambda]=\alpha/\beta\) and \(\operatorname{Var}(\Lambda)=\alpha/\beta^2\). These follow by integrating powers of \(\lambda\) against the density and using \(\Gamma(a+1)=a\Gamma(a)\). Conditional on \(\Lambda\), a Poisson variable has mean and variance \(\Lambda\). The laws of total expectation and total variance therefore give
and
For the factorial moments, differentiate \(G_X(z)=(\beta/(\beta+1-z))^\alpha\) \(m\) times. For each integer \(m\geq 1\),
The power-series definition of the probability-generating function gives \(G_X^{(m)}(1)=E[(X)_m]\); the differentiation is valid because the generating function is finite in a neighborhood of \(1\). Substitution of \(z=1\) gives the stated formula. In particular, \(E[X(X-1)]=\alpha(\alpha+1)/\beta^2\); using \(X^2=X(X-1)+X\) recovers the variance formula. \(\square\)
Worked Example: Translating Negative-Binomial Parameters
A negative-binomial count \(X\) has shape \(r=4\) and success probability \(p=0.6\), with \(X\) counting failures before \(r\) successes. Find the corresponding gamma mixing distribution and calculate the mean and variance.
Matching \(r=\alpha\) and \(p=\beta/(\beta+1)\) gives \(\alpha=4\) and
Thus this negative-binomial law is the marginal distribution obtained by mixing a Poisson count over \(\Lambda\sim\operatorname{Gamma}(4,3/2)\). Its mean and variance are
The variance-to-mean ratio is \((40/9)/(8/3)=5/3\), greater than one.
Interpreting the Extra Variance
A fixed-rate Poisson variable has variance equal to its mean. In the mixture, the conditional variance still equals the conditional mean, but the rate itself varies across units. The variance decomposition separates these contributions:
For \(\alpha,\beta>0\), the second term \(\alpha/\beta^2\) is positive. Consequently, the marginal count is overdispersed relative to a Poisson distribution with the same mean: its variance is strictly larger than its mean. This is why a gamma-Poisson mixture is a useful model when count variation exceeds what a single fixed-rate Poisson model allows.
Worked Example: Zero Counts and Overdispersion
Let \(\Lambda\sim\operatorname{Gamma}(2,1/4)\), where \(1/4\) is the rate, and let \(X\mid\Lambda\sim\operatorname{Poisson}(\Lambda)\). Calculate \(P(X=0)\), \(P(X=1)\), and compare the variance with the mean.
The negative-binomial parameters are \(r=2\), \(p=(1/4)/(1+1/4)=1/5\), and \(1-p=4/5\). Therefore
and
The mean and variance are
The variance is five times the mean. This difference is not an arithmetic anomaly: the random rate has variance \(2/(1/4)^2=32\), and that between-rate variation adds to the conditional Poisson variation of \(8\).
Common Parameterization Pitfalls
Negative-binomial notation is not universal, so a parameter pair without a stated convention can be ambiguous. In this tutorial, \(r\) is the shape and \(p\) is the success probability in a count of failures before \(r\) successes. Some sources instead count successes before a fixed number of failures, or use a mean parameter. Always check the mass function rather than relying on the distribution name alone.
- Confusing gamma rate and scale. With shape-rate parameters, \(E[\Lambda]=\alpha/\beta\). If the gamma is given by shape and scale \(s\), then \(s=1/\beta\) and \(E[\Lambda]=\alpha s\).
- Reversing the negative-binomial probabilities. The gamma rate maps to \(p=\beta/(\beta+1)\), while the factor raised to \(k\) is \(1-p=1/(\beta+1)\).
- Assuming the marginal count remains Poisson. Conditional on the rate it is Poisson; after averaging over a non-degenerate gamma rate, its variance exceeds its mean.
- Using the wrong count convention. Under the failure-count convention, the mass at zero is \(p^r\), which provides a quick check on parameter matching.
Check Your Understanding
Use the failure-count negative-binomial convention throughout.
- If \(\Lambda\sim\operatorname{Gamma}(5,3)\) in the shape-rate convention, what are the negative-binomial shape and success probability?
- For a gamma-Poisson mixture with \(\alpha=2\) and \(\beta=1\), calculate the mean and variance, and explain why they differ.
- A negative-binomial count has \(r=3\) and \(p=1/4\). What gamma shape and rate produce it as a Poisson mixture?
- Why does a non-degenerate gamma mixing distribution make the marginal count variance exceed its mean?
- For parameters \(r\) and \(p\), what is the probability of zero under the failure-count convention, and how can it check a proposed parameter match?