In probability theory and statistics, the negative binomial distribution, also called a Pascal distribution, is a discrete probability distribution that models the number of failures in a sequence of independent and identically distributed Bernoulli trials before a specified/constant/fixed number of successes r occur. (Sometimes the roles are swapped: the number of failures is fixed and the number of successes is modeled.) 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 (r=3). 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 days n (random) a certain machine works (specified by r) before it breaks down. The negative binomial distribution has a variance μ/p, with the distribution becoming identical to Poisson in the limit p→1 for a given mean μ (i.e. when the failures are increasingly rare). Here p∈[0,1] is the success probability of each Bernoulli trial. This can make the distribution a useful overdispersed alternative to the Poisson distribution, for example for a robust modification of Poisson 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. More generally, it may be appropriate where events have positively correlated occurrences causing a larger variance than if the occurrences were independent, due to a positive covariance term. The term "negative binomial" is likely due to the fact that a certain binomial coefficient that appears in the formula for the probability mass function of the distribution can be written more simply with negative numbers.
Definitions Imagine a sequence of independent Bernoulli trials: each trial has two potential outcomes called "success" and "failure." In each trial the probability of success is p and of failure is 1−p. We observe this sequence until a predefined number r of successes occurs. Then the random number of observed failures, X, follows the negative binomial distribution: X∼NB(r,p)
Probability mass function The probability mass function of the negative binomial distribution is f(k;r,p)≡Pr(X=k)=(k+r−1k)(1−p)kpr where r is the number of successes, X = k is the number of failures before the r-th success, and p is the probability of success on each trial. Here, the quantity in parentheses is the binomial coefficient, and is equal to (k+r−1k)=(k+r−1)!(r−1)!k!=(k+r−1)(k+r−2)⋯(r)k!=Γ(k+r)k! Γ(r)=((rk)). Note that Γ(r) is the Gamma function, and ((rk)) is the multiset coefficient. There are k failures chosen from k + r − 1 trials rather than k + r because the last of the k + r trials is by definition a success. This quantity can alternatively be written in the following manner, explaining the name "negative binomial": (k+r−1)⋯(r)k!=(−1)k(−r)(−r−1)(−r−2)⋯(−r−(k−1))⏞k factorsk!=(−1)k(−r−k). Note that by the last expression and the binomial series, for every 0 ≤ p < 1 and q=1−p, p−r=(1−q)−r=∑k=0∞(−r−k)(−q)k=∑k=0∞(k+r−1k)qk hence the terms of the probability mass function indeed add up to one as below. ∑k=0∞(k+r−1k)(1−p)kpr=p−rpr=1 To understand the above definition of the probability mass function, note that the probability for every specific sequence of r successes and k failures is pr(1 − p)k, because the outcomes of the k + r trials are supposed to happen independently. Since the r-th success always comes last, it remains to choose the k trials with failures out of the remaining k + r − 1 trials. The above binomial coefficient, due to its combinatorial interpretation, gives precisely the number of all these sequences of length k + r − 1. An alternate interpretation of the probability mass function's binomial coefficient arises when considering the equivalent multiset coefficient ((rk)). A sequence of trials ending in r successes can be represented by a tuple of r non-negative integers, where each integer represents the number of failures seen before the next success. Then by applying stars and bars, it can be seen that the number of such tuples that sum to k (and hence represent k total failures and r total successes) is given by ((rk)).
Cumulative distribution function The cumulative distribution function can be expressed in terms of the regularized incomplete beta function: F(k;r,p)≡Pr(X≤k)=Ip(r,k+1). for non-negative integer k. This formula is using the same parameterization as in the article's table, with r the number of successes, and p=r/(r+μ) with μ the mean. It can also be expressed in terms of the cumulative distribution function of the binomial distribution: F(k;r,p)=Fbinomial(k;n=k+r,1−p).
Alternative formulations Some sources may define the negative binomial distribution slightly differently from the primary one here. The most common variations are where the random variable X 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: (ab)=(aa−b)for 0≤b≤a. 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: n=r+k. These second formulations may be more intuitive to understand, however they are perhaps less practical as they have more terms.
… excerpt ends here. Continue reading the full article.

