Negative Binomial Distribution Calculator

StatisticsLast updated: August 22, 2026

The negative binomial (Pascal) distribution models how long it takes to reach a predetermined rth success in independent trials with success probability p. It is the mirror image of the binomial setup: in the binomial the number of trials is fixed and the number of successes is random, while in the negative binomial the number of successes is fixed and the number of trials is random. How many calls it takes to reach a third sale, how many defective parts appear before the fifth sound one, and how many shots are needed for a second goal are all questions of this kind.

This calculator uses the engine's definition directly: X is the number of FAILURES seen BEFORE the rth success, and the support is 0, 1, 2, … . The results give P(X = k), the cumulative probabilities, the probability of the interval you choose, and the mean r(1 − p)/p, the variance r(1 − p)/p², the standard deviation, and the mode. The same result translated into the 'total number of trials' definition (trials = k + r, mean trials = r/p) is shown separately, so you can read the value directly whichever definition your source uses.

Enter which success you are waiting for. With r = 1 the distribution reduces to the geometric distribution.
Enter a value between 0 and 1 (0.4 for forty percent). A decimal comma is also accepted as the separator.
The number of failures seen before the rth success. The total number of trials is then k + r.
Lower bound for P(a ≤ X ≤ b). Left blank, it is taken as 0.
Upper bound for P(a ≤ X ≤ b). Left blank, the upper bound is taken as infinite.

Negative Binomial Formulas (number-of-failures definition)

Mass function:      P(X = k) = C(k + r − 1, k) · pʳ · (1 − p)ᵏ,  k = 0, 1, 2, …
Definition:         X = number of failures BEFORE the rth success
Trial equivalent:   T = X + r  →  P(T = t) = C(t − 1, r − 1) · pʳ · (1 − p)ᵗ⁻ʳ
Cumulative:         P(X ≤ k) = Iₚ(r, k + 1)   (regularized incomplete beta)
Upper tail:         P(X ≥ k) = 1 − P(X ≤ k − 1)
Mean:               μ = r(1 − p) / p        (r / p under the trial definition)
Variance:           σ² = r(1 − p) / p²      (the same under both definitions)
Standard deviation: σ = √[r(1 − p)] / p
Mode:               ⌊(r − 1)(1 − p) / p⌋ for r > 1;  0 for r = 1
Special case:       r = 1 → geometric distribution

The cumulative probability is computed with the regularized incomplete beta function instead of a summation loop, so the result stays exact even when r and k grow large. Although r need not be an integer in the formula (the Polya distribution), this calculator works with integer r.

How to Calculate

  1. Enter the number of successes you are targeting (r): write which success you are waiting for.
  2. Enter the single-trial success probability (p) between 0 and 1; write 0.4 for forty percent.
  3. Enter the number of failures (k) whose probability you want; the total number of trials is shown automatically as k + r.
  4. If you like, set the interval bounds (a and b); leaving the upper bound blank computes P(X ≥ a).
  5. Read the values under both the number-of-failures definition and the total-trials definition; use the 'Total trials' column of the table to keep the two apart.
  6. In the mass chart, observe the right skew of the distribution and how the mode sits below the mean.

Worked Examples

4 failures before the 3rd success

With r = 3 and p = 0.4, the probability of seeing exactly 4 failures before the 3rd success is P(X = 4) = 0.1244; that means the 3rd success arrives exactly on trial 7. The probability of reaching the target with at most 4 failures is 0.5801, and P(2 ≤ X ≤ 6) = 0.5890. On average 4.5 failures, that is 7.5 trials in total, are expected; the standard deviation is 3.3541 and the mode is 2.

Exactly 4 failures — P(X = 4): 0.1244 · At most 4 failures — P(X ≤ 4): 0.5801 · Fewer than 4 — P(X < 4): 0.4557

r = 1: reduction to the geometric distribution

With r = 1 the distribution becomes geometric. For p = 0.25, the probability of exactly 3 failures before the first success is P(X = 3) = 0.1055; that is, the first success arrives on trial 4. P(0 ≤ X ≤ 5) = 0.8220, and on average 3 failures and 4 trials in total are expected. The mode is 0: the most likely outcome is a success on the very first trial.

Exactly 3 failures — P(X = 3): 0.1055 · At most 3 failures — P(X ≤ 3): 0.6836 · Fewer than 3 — P(X < 3): 0.5781

Calls needed for a 5th sale

For a representative who closes 20% of calls, the probability of making exactly 20 unsuccessful calls before the 5th sale is P(X = 20) = 0.0392 (25 calls in total). The probability of reaching the target with at most 20 failures is 0.5793. On average 20 failures, that is 25 calls in total, are expected; the standard deviation is 10 and P(15 ≤ X ≤ 30) = 0.5298.

Exactly 20 failures — P(X = 20): 0.0392 · At most 20 failures — P(X ≤ 20): 0.5793 · Fewer than 20 — P(X < 20): 0.5401

Frequently Asked Questions

In the negative binomial distribution, does X count trials or failures?
Both definitions are common, and mixing them up leads to misreading the result. This calculator uses the engine's definition: X is the number of FAILURES before the rth success, the support starts at 0, and the mean is r(1 − p)/p. Under the total-trials definition the support starts at r and the mean is r/p; the two are linked by Trials = Failures + r. The calculator shows both values together.
How does it differ from the binomial distribution?
In the binomial distribution the number of trials n is fixed and the number of successes is random. In the negative binomial the number of successes r is fixed and the number of trials required is random. The two distributions read the same Bernoulli trials from opposite ends; the 'stopping rule' differs, so the same data yields two different probability models.
Why is it called the 'negative' binomial?
The name comes from the coefficient in the mass function, which arises from a binomial expansion with a negative exponent (Newton's generalized binomial theorem): the terms of the expansion of (1 − q)^(−r) are exactly these probabilities. Nothing about the distribution itself is negative; the name is purely algebraic in origin. The name Pascal distribution is also used for the same distribution when r is an integer.
How is it computed in Excel, SPSS, and R?
In Excel, =NEGBINOM.DIST(k, r, p, FALSE) gives the exact probability and the TRUE flag gives the cumulative one, using the number-of-failures definition. In R, dnbinom(k, r, p) and pnbinom(k, r, p) follow the same definition. In Python, scipy.stats.nbinom.pmf(k, r, p) also counts failures. In SPSS, the PDF.NEGBIN(t, r, p) function uses the total number of trials, so you have to write t = k + r.
Why use the negative binomial instead of the Poisson for count data?
The Poisson distribution requires the mean and the variance to be equal. In real count data the variance is usually larger than the mean (overdispersion); in that case Poisson regression underestimates the standard errors and produces spuriously significant results. Because the negative binomial carries an extra dispersion parameter, it can model that excess variability and gives more trustworthy p-values.
What happens if I choose r = 1?
The distribution reduces to the geometric distribution: P(X = k) = p·(1 − p)^k, modeling the number of failures before the first success. The mean is (1 − p)/p, and the mean number of trials is 1/p. If you are interested only in the first success, the geometric distribution calculator is a more direct route.
Is it normal for the mode to be smaller than the mean?
Yes. The negative binomial distribution is right-skewed: the long right tail pulls the mean upward while the most probable value (the mode) stays on the left. That is why a statement such as '7.5 trials are needed on average' describes the long-run arithmetic mean rather than the typical scenario. Reporting the mode, the median, and the tail probabilities together is more informative.