The negative binomial distribution is a discrete probability distribution on the nonnegative integers. In its classical interpretation, it describes the number of failures before a specified number of successes in independent trials with a constant success probability. A more general formulation permits a positive, noninteger shape parameter and arises as a mixture of Poisson distributions with gamma-distributed rates. This formulation makes the negative binomial an important model for count data whose variance exceeds their mean.
Definition and parameter conventions
Let be the number of failures before the th success, where each trial has success probability . Initially, take to be a positive integer and . The probability mass function is
Here is the required number of successes, and counts failures. The binomial coefficient counts the ways to arrange failures and successes before the final, required success.
The distribution extends to every real through the gamma function:
The notation will refer here to this failures-counting convention. At , its natural extension is the degenerate distribution concentrated at zero.
Alternative conventions
Parameter conventions differ substantially across textbooks and software.
Some definitions count the total number of trials, , rather than failures. For integer , its support is , and
Some authors interchange and , so that denotes the probability of a counted event rather than the stopping event.
Statistical models often use a mean and a dispersion parameter instead of and .
The name Pascal distribution is commonly associated with the integer-shape case. Gamma–Poisson distribution emphasizes the mixture representation. The name Pólya distribution is also used, although naming conventions are not uniform.
Derivation from repeated trials
Consider a sequence of independent trials, each following a Bernoulli distribution with success probability .
For the th success to occur after exactly failures:
- The first trials must contain successes and failures.
- The next trial must be a success.
Every such sequence has probability , and there are possible initial arrangements. Multiplying these quantities gives the probability mass function.
This distinguishes the negative binomial from the binomial distribution. A binomial experiment fixes the number of trials and counts successes; a negative binomial experiment fixes the number of successes and counts failures, or equivalently the required number of trials.
For example, if each trial succeeds with probability , the probability of exactly two failures before the third success is
The labels “success” and “failure” are mathematical conventions and need not indicate desirable or undesirable outcomes.
Why the distribution is called negative binomial
The name comes from the binomial expansion with a negative exponent. For ,
Substituting and multiplying by shows that the probabilities sum to one.
Equivalently, the generalized coefficients satisfy
Thus “negative” refers to the exponent or upper binomial argument, not to the possible values of the random variable, which are nonnegative.
Moments and generating function
Under the failures-counting convention, the expected value and variance are
The probability generating function is
Its derivatives at give the factorial moments:
for positive integers .
For the total-trials convention,
The shift changes the mean but not the variance.
Mean–dispersion parameterization
Writing gives
and therefore
The variance becomes
If , this is
At a fixed positive mean, smaller , or larger , produces greater dispersion. Since the variance exceeds the mean for finite , this parameterization is useful for overdispersed counts relative to a Poisson model.
Gamma–Poisson mixture representation
The negative binomial distribution can arise without any sequence of successes and failures.
Suppose a count is conditionally Poisson:
and its rate follows a gamma distribution with shape and rate :
Integrating over the unobserved rate gives
This is the negative binomial distribution with
The representation explains why a negative binomial can model heterogeneous event rates. Even if observations are Poisson conditional on their individual rates, variation among those rates increases the marginal variance:
It also provides a simulation method: draw a gamma-distributed rate, then draw a Poisson count conditional on that rate.
Bayesian predictive interpretation
In Bayesian inference, the gamma distribution is a conjugate prior for a Poisson rate. Integrating a Poisson sampling model against a gamma posterior produces a negative binomial posterior predictive distribution.
For example, if the posterior rate is gamma with shape and rate , a future count observed over exposure has negative binomial parameters
Here the negative binomial represents uncertainty about the future count after accounting for uncertainty in its underlying rate.
Related distributions and limiting behavior
Geometric special case
When ,
This is the failures-counting form of the geometric distribution. For integer , a negative binomial variable can be represented as the sum of independent geometric variables with the same success probability.
Addition with a common probability parameter
If independent variables satisfy
then
This holds for arbitrary positive real shapes. It follows by multiplying their generating functions, or through convolution of their probability masses. The common value of is essential: sums with different probability parameters are not generally negative binomial.
Poisson limit
Hold fixed and let
Then
Correspondingly, the variance approaches . The Poisson distribution is therefore a limiting case with vanishing extra dispersion.
Normal approximation
For fixed , increasing yields an approximately normal shape after standardization. For integer , this follows from the sum-of-geometric representation and the central limit theorem.
A large mean alone does not guarantee a good normal approximation: with small fixed , substantial right skewness can persist even as the mean increases.
Parameter estimation
For independent observations , let be the sample mean, and define the empirical second central moment
Matching empirical and theoretical moments gives
provided . Substituting an unbiased sample variance is another common finite-sample convention.
If the empirical variance does not exceed the mean, these formulas do not yield a finite positive shape estimate. This does not make such a sample impossible under a negative binomial model, but it limits the usefulness of this moment-matching procedure.
For maximum likelihood estimation, the log-likelihood function is
For fixed , its maximizing value of is
Estimation of generally requires numerical optimization. When the fitted extra dispersion approaches zero, tends toward infinity and the model approaches the Poisson boundary.
Negative binomial regression
Negative binomial regression relates the mean count to explanatory variables, commonly through
It is widely used within the generalized linear model framework. The log link keeps fitted means positive and gives exponentiated coefficients a multiplicative interpretation.
When counts refer to different exposures, such as different observation periods, a model may include an exposure offset:
where is the exposure and its log has coefficient fixed at one.
The quadratic variance formulation is often called NB2. Another specification, NB1, uses
Both can use negative binomial conditional distributions, but they impose different relationships between mean and dispersion across observations. In NB2 the shape is constant when is constant; in NB1 the shape varies with the mean.
Applications and limitations
Negative binomial models appear in ecology, insurance, traffic analysis, econometrics, and sequencing-based studies of gene expression. Their common role is to describe counts with more variability than a Poisson model permits.
Several distinctions matter when interpreting such models:
- Overdispersion does not identify its cause. Unobserved rate heterogeneity is one explanation, but omitted predictors, dependence, or an incorrect mean model can also produce it.
- Dispersion does not automatically model dependence. Independent negative binomial observations remain independent. Repeated measurements, clusters, or a time series may require additional dependence structure.
- Extra zeros do not necessarily imply a separate zero-generating process. A negative binomial can already assign substantial probability to zero. Zero-inflated or hurdle models introduce additional assumptions rather than merely allowing a larger variance.
- Underdispersion is outside the standard family. A negative binomial count with positive mean cannot have variance below its mean.
- Sampling restrictions change the distribution. If zero counts are unobservable, the appropriate likelihood is zero-truncated rather than the ordinary negative binomial likelihood.
- Equal means and variances do not establish distributional fit. Tail behavior, zero frequencies, and conditional patterns can differ between distributions with similar first two moments.