Different texts (and even different parts of this article) adopt slightly different definitions for the negative binomial distribution. They can be distinguished by whether the support starts atk = 0 or atk = r, whetherp denotes the probability of a success or of a failure, and whetherr represents success or failure,[1] so identifying the specific parametrization used is crucial in any given text.
Probability mass function
The orange line represents the mean, which is equal to 10 in each of these plots; the green line shows the standard deviation.
r > 0 — number of successes until the experiment is stopped (integer, but the definition can also be extended toreals) p ∈ [0,1] — success probability in each experiment (real)
Inprobability theory andstatistics, thenegative binomial distribution, also called aPascal distribution,[2] is adiscrete probability distribution that models the number of failures in a sequence of independent and identically distributedBernoulli trials before a specified/constant/fixed number of successes occur.[3] For example, we can define rolling a 6 on some dice as a success, and rolling any other number as a failure, and ask how many failure rolls will occur before we see the third success (). In such a case, the probability distribution of the number of failures that appear will be a negative binomial distribution.
An alternative formulation is to model the number of total trials (instead of the number of failures). In fact, for a specified (non-random) number of successes(r), the number of failures(n −r) is random because the number of total trials(n) is random. For example, we could use the negative binomial distribution to model the number of daysn (random) a certain machine works (specified byr) before it breaks down.
The negative binomial distribution has a variance, with the distribution becoming identical to Poisson in the limit for a given mean (i.e. when the failures are increasingly rare). Here is the success probability of each Bernoulli trial. This can make the distribution a usefuloverdispersed alternative to the Poisson distribution, for example for arobust modification ofPoisson regression. In epidemiology, it has been used to model disease transmission for infectious diseases where the likely number of onward infections may vary considerably from individual to individual and from setting to setting.[4] More generally, it may be appropriate where events have positively correlated occurrences causing a largervariance than if the occurrences were independent, due to a positivecovariance term.
The term "negative binomial" is likely due to the fact that a certainbinomial coefficient that appears in the formula for theprobability mass function of the distribution can be written more simply with negative numbers.[5]
Imagine a sequence of independentBernoulli trials: each trial has two potential outcomes called "success" and "failure." In each trial the probability of success is and of failure is. We observe this sequence until a predefined number of successes occurs. Then the random number of observed failures,, follows thenegative binomial distribution:
Theprobability mass function of the negative binomial distribution iswherer is the number of successes,k is the number of failures, andp is the probability of success on each trial.
There arek failures chosen fromk +r − 1 trials rather thank +r because the last of thek +r trials is by definition a success.
This quantity can alternatively be written in the following manner, explaining the name "negative binomial":
Note that by the last expression and thebinomial series, for every0 ≤p < 1 and,
hence the terms of the probability mass function indeed add up to one as below.
To understand the above definition of the probability mass function, note that the probability for every specific sequence ofr successes andk failures ispr(1 −p)k, because the outcomes of thek +r trials are supposed to happenindependently. Since ther-th success always comes last, it remains to choose thek trials with failures out of the remainingk +r − 1 trials. The above binomial coefficient, due to its combinatorial interpretation, gives precisely the number of all these sequences of lengthk +r − 1.
An alternate interpretation of the probability mass function's binomial coefficient arises when considering the equivalent multiset coefficient. A sequence of trials ending inr successes can be represented by a tuple ofr non-negative integers, where each integer represents the number of failures seen before the next success. Then by applyingstars and bars, it can be seen that the number of such tuples that sum tok (and hence representk total failures andr total successes) is given by.
Some sources may define the negative binomial distribution slightly differently from the primary one here. The most common variations are where the random variableX is counting different things. These variations can be seen in the table here:
Each of the four definitions of the negative binomial distribution can be expressed in slightly different but equivalent ways. The first alternative formulation is simply an equivalent form of the binomial coefficient, that is:. The second alternate formulation somewhat simplifies the expression by recognizing that the total number of trials is simply the number of successes and failures, that is:. These second formulations may be more intuitive to understand, however they are perhaps less practical as they have more terms.
The definition whereX is the number ofntrials that occur for a given number ofrsuccesses is similar to the primary definition, except that the number of trials is given instead of the number of failures. This addsr to the value of the random variable, shifting its support and mean.
The definition whereX is the number ofksuccesses (orntrials) that occur for a given number ofrfailures is similar to the primary definition used in this article, except that numbers of failures and successes are switched when considering what is being counted and what is given. Note however, thatp still refers to the probability of "success".
The definition of the negative binomial distribution can be extended to the case where the parameterr can take on a positivereal value. Although it is impossible to visualize a non-integer number of "failures", we can still formally define the distribution through its probability mass function. The problem of extending the definition to real-valued (positive)r boils down to extending the binomial coefficient to its real-valued counterpart, based on thegamma function: After substituting this expression in the original definition, we say thatX has a negative binomial (orPólya) distribution if it has aprobability mass function: Herer is a real, positive number.
The variance can then be written as. Some authors prefer to set, and express the variance as. In this context, and depending on the author, either the parameterr or its reciprocalα is referred to as the "dispersion parameter", "shape parameter" or "clustering coefficient",[17] or the "heterogeneity"[16] or "aggregation" parameter.[11] The term "aggregation" is particularly used in ecology when describing counts of individual organisms. Decrease of the aggregation parameterr towards zero corresponds to increasing aggregation of the organisms; increase ofr towards infinity corresponds to absence of aggregation, as can be described byPoisson regression.
Pat Collis is required to sell candy bars to raise money for the 6th grade field trip. Pat is (somewhat harshly) not supposed to return home until five candy bars have been sold. So the child goes door to door, selling candy bars. At each house, there is a 0.6 probability of selling one candy bar and a 0.4 probability of selling nothing.
What's the probability of selling the last candy bar at then-thhouse?
Successfully selling candy enough times is what defines our stopping criterion (as opposed to failing to sell it), sok in this case represents the number of failures andr represents the number of successes. Recall that theNB(r,p) distribution describes the probability ofk failures andr successes ink +rBernoulli(p) trials with success on the last trial. Selling five candy bars means getting five successes. The number of trials (i.e. houses) this takes is thereforek + 5 =n. The random variable we are interested in is the number of houses, so we substitutek =n − 5 into aNB(5, 0.4) mass function and obtain the following mass function of the distribution of houses (forn ≥ 5):
What's the probability that Pat finishes on the tenth house?
What's the probability that Pat finishes on or before reaching the eighth house?
To finish on or before the eighth house, Pat must finish at the fifth, sixth, seventh, or eighth house. Sum those probabilities:
What's the probability that Pat exhausts all 30 houses that happen to stand in the neighborhood?
This can be expressed as the probability that Patdoes not finish on the fifth through the thirtieth house:
Because of the rather high probability that Pat will sell to each house (60 percent), the probability of hernot fulfilling her quest is vanishingly slim.
The expected total number of failures in a negative binomial distribution with parameters(r,p) isr(1 −p)/p. To see this, imagine an experiment simulating the negative binomial is performed many times. That is, a set of trials is performed untilr successes are obtained, then another set of trials, and then another etc. Write down the number of trials performed in each experiment:a,b,c, ... and seta +b +c + ... =N. Now we would expect aboutNp successes in total. Say the experiment was performedn times. Then there arenr successes in total. So we would expectnr =Np, soN/n =r/p. See thatN/n is just the average number of trials per experiment. That is what we mean by "expectation". The average number of failures per experiment isN/n −r =r/p −r =r(1 −p)/p. This agrees with the mean given in the box on the right-hand side of this page.
A rigorous derivation can be done by representing the negative binomial distribution as the sum of waiting times. Let with the convention represents the number of failures observed before successes with the probability of success being. And let where represents the number of failures before seeing a success. We can think of as the waiting time (number of failures) between theth andth success. ThusThe mean iswhich follows from the fact.
When counting the number of failures before ther-th success, the variance is r(1 −p)/p2. When counting the number of successes before ther-th failure, as in alternative formulation (3) above, the variance is rp/(1 −p)2.
in which the upper bound of summation is infinite. In this case, thebinomial coefficient
is defined whenn is a real number, instead of just a positiveinteger. But in our case of the binomial distribution it is zero whenk >n. We can then say, for example
Now supposer > 0 and we use a negative exponent:
Then all of the terms are positive, and the term
is just the probability that the number of failures before ther-th success is equal tok, providedr is an integer. (Ifr is a negative non-integer, so that the exponent is a positive non-integer, then some of the terms in the sum above are negative, so we do not have a probability distribution on the set of all nonnegative integers.)
Now we also allow non-integer values ofr.
Recall from above that
The sum of independent negative-binomially distributed random variablesr1 andr2 with the same value for parameterp is negative-binomially distributed with the samep but withr-value r1 +r2.
This property persists when the definition is thus generalized, and affords a quick way to see that the negative binomial distribution isinfinitely divisible.
Consider a sequence of negative binomial random variables where the stopping parameterr goes to infinity, while the probabilityp of success in each trial goes to one, in such a way as to keep the mean of the distribution (i.e. the expected number of failures) constant. Denoting this mean asλ, the parameterp will bep =r/(r +λ)
Under this parametrization the probability mass function will be
Now if we consider the limit asr → ∞, the second factor will converge to one, and the third to the exponent function:which is the mass function of aPoisson-distributed random variable with expected value λ.
In other words, the alternatively parameterized negative binomial distributionconverges to the Poisson distribution andr controls the deviation from the Poisson. This makes the negative binomial distribution suitable as a robust alternative to the Poisson, which approaches the Poisson for larger, but which has larger variance than the Poisson for smallr.
The negative binomial distribution also arises as a continuous mixture ofPoisson distributions (i.e. acompound probability distribution) where the mixing distribution of the Poisson rate is agamma distribution. That is, we can view the negative binomial as aPoisson(λ) distribution, whereλ is itself a random variable, distributed as a gamma distribution with shaper and scaleθ = (1 −p)/p or correspondingly rateβ =p/(1 −p).
To display the intuition behind this statement, consider two independent Poisson processes, "Success" and "Failure", with intensitiesp and1 −p. Together, the Success and Failure processes are equivalent to a single Poisson process of intensity 1, where an occurrence of the process is a success if a corresponding independent coin toss comes up heads with probabilityp; otherwise, it is a failure. Ifr is a counting number, the coin tosses show that the count of successes before ther-th failure follows a negative binomial distribution with parametersr and1 −p. The count is also, however, the count of the Success Poisson process at the random timeT of ther-th occurrence in the Failure Poisson process. The Success count follows a Poisson distribution with meanpT, whereT is the waiting time forr occurrences in a Poisson process of intensity1 −p, i.e.,T is gamma-distributed with shape parameterr and intensity1 −p. Thus, the negative binomial distribution is equivalent to a Poisson distribution with meanpT, where the random variateT is gamma-distributed with shape parameterr and intensity(1 −p). The preceding paragraph follows, becauseλ =pT is gamma-distributed with shape parameterr and intensity(1 −p)/p.
The following formal derivation (which does not depend onr being a counting number) confirms the intuition.
Because of this, the negative binomial distribution is also known as thegamma–Poisson (mixture) distribution. The negative binomial distribution was originally derived as a limiting case of the gamma-Poisson distribution.[20]
Distribution of a sum of geometrically distributed random variables
IfYr is a random variable following the negative binomial distribution with parametersr andp, and support{0, 1, 2, ...}, thenYr is a sum ofrindependent variables following thegeometric distribution (on{0, 1, 2, ...}) with parameterp. As a result of thecentral limit theorem,Yr (properly scaled and shifted) is therefore approximatelynormal for sufficiently large r.
Furthermore, ifBs+r is a random variable following thebinomial distribution with parameterss +r andp, then
In this sense, the negative binomial distribution is the "inverse" of the binomial distribution.
The sum of independent negative-binomially distributed random variablesr1 andr2 with the same value for parameterp is negative-binomially distributed with the samep but withr-value r1 +r2.
The negative binomial distribution isinfinitely divisible, i.e., ifY has a negative binomial distribution, then for any positive integern, there exist independent identically distributed random variablesY1, ...,Yn whose sum has the same distribution thatY has.
LetN be a random variable,independent of the sequence, and suppose thatN has aPoisson distribution with meanλ = −r ln(1 −p). Then the random sum
isNB(r,p)-distributed. To prove this, we calculate theprobability generating functionGX ofX, which is the composition of the probability generating functionsGN andGY1. Using
and
we obtain
which is the probability generating function of theNB(r,p) distribution.
The following table describes four distributions related to the number of successes in a sequence of draws:
Supposep is unknown and an experiment is conducted where it is decided ahead of time that sampling will continue untilr successes are found. Asufficient statistic for the experiment isk, the number of failures.
but this is abiased estimate. Its inverse(r +k)/r, is an unbiased estimate of1/p, however.[21]
Whenr is unknown, the maximum likelihood estimator forp andr together only exists for samples for which the sample variance is larger than the sample mean.[22] Thelikelihood function forNiid observations(k1, ...,kN) is
from which we calculate the log-likelihood function
To find the maximum we take the partial derivatives with respect tor andp and set them equal to zero:
Letk andr be integers withk non-negative andr positive. In a sequence of independentBernoulli trials with success probabilityp, the negative binomial gives the probability ofk successes andr failures, with a failure on the last trial. Therefore, the negative binomial distribution represents the probability distribution of the number of successes before ther-th failure in aBernoulli process, with probabilityp of successes on each trial.
Consider the following example. Suppose we repeatedly throw a die, and consider a 1 to be a failure. The probability of success on each trial is 5/6. The number of successes before the third failure belongs to the infinite set{ 0, 1, 2, 3, ... }. That number of successes is a negative-binomially distributed random variable.
Whenr = 1 we get the probability distribution of number of successes before the first failure (i.e. the probability of the first failure occurring on the(k + 1)-st trial), which is ageometric distribution:
The negative binomial distribution, especially in its alternative parameterization described above, can be used as an alternative to the Poisson distribution. It is especially useful for discrete data over an unbounded positive range whose samplevariance exceeds the samplemean. In such cases, the observations areoverdispersed with respect to a Poisson distribution, for which the mean is equal to the variance. Hence a Poisson distribution is not an appropriate model. Since the negative binomial distribution has one more parameter than the Poisson, the second parameter can be used to adjust the variance independently of the mean. SeeCumulants of some discrete probability distributions.
An application of this is to annual counts oftropical cyclones in theNorth Atlantic or to monthly to 6-monthly counts of wintertimeextratropical cyclones over Europe, for which the variance is greater than the mean.[23][24][25] In the case of modest overdispersion, this may produce substantially similar results to an overdispersed Poisson distribution.[26][27]
Negative binomial modeling is widely employed in ecology and biodiversity research for analyzingcount data where overdispersion is very common. This is because overdispersion is indicative of biological aggregation, such as species or communities forming clusters. Ignoring overdispersion can lead to significantly inflated model parameters, resulting in misleading statistical inferences. The negative binomial distribution effectively addresses overdispersed counts by permitting the variance to vary quadratically with the mean. An additional dispersion parameter governs the slope of the quadratic term, determining the severity of overdispersion. The model's quadratic mean-variance relationship proves to be a realistic approach for handling overdispersion, as supported by empirical evidence from many studies. Overall, the NB model offers two attractive features: (1) the convenient interpretation of the dispersion parameter as an index of clustering or aggregation, and (2) its tractable form, featuring a closed expression for the probability mass function.[28]
In genetics, the negative binomial distribution is commonly used to model data in the form of discrete sequence read counts from high-throughput RNA and DNA sequencing experiments.[29][30][31][32]
In epidemiology of infectious diseases, the negative binomial has been used as a better option than the Poisson distribution to model overdispersed counts of secondary infections from one infected case (super-spreading events).[33]
The negative binomial distribution has been the most effectivestatistical model for a broad range of multiplicity observations inparticle collision experiments, e.g.,[34][35][36][37][38] (See[39] for an overview), and is argued to be ascale-invariant property of matter,[40][41] providing the best fit for astronomical observations, where it predicts the number of galaxies in a region of space.[42][43][44][45] The phenomenological justification for the effectiveness of the negative binomial distribution in these contexts remained unknown for fifty years, since their first observation in 1973.[46] In 2023, a proof fromfirst principles was eventually demonstrated by Scott V. Tezlaf, where it was shown that the negative binomial distribution emerges fromsymmetries in thedynamical equations of acanonical ensemble of particles inMinkowski space.[47] Roughly, given an expected number of trials and expected number of successes, where
anisomorphic set of equations can be identified with the parameters of arelativisticcurrent density of a canonical ensemble of massive particles, via
where is the restdensity, is the relativistic mean square density, is the relativistic mean square current density, and, where is themean square speed of the particle ensemble and is thespeed of light—such that one can establish the followingbijective map:
A rigorous alternative proof of the above correspondence has also been demonstrated throughquantum mechanics via the Feynmanpath integral.[47]
^Airoldi, E. M.; Cohen, W. W.; Fienberg, S. E. (June 2005). "Bayesian Models for Frequent Terms in Text".Proceedings of the Classification Society of North America and INTERFACE Annual Meetings. Vol. 990. St. Louis, MO, USA. p. 991.
^Kittel, Wolfram; De Wolf, Eddi A (2005).Soft multihardon dynamics. World Scientific.
^Schaeffer, R (1984). "Determination of the galaxy N-point correlation function".Astronomy and Astrophysics.134 (2): L15.Bibcode:1984A&A...134L..15S.
^Schaeffer, R (1985). "The probability generating function for galaxy clustering".Astronomy and Astrophysics.144 (1):L1–L4.Bibcode:1985A&A...144L...1S.