Negative Binomial Distribution Calculator
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.
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
- Enter the number of successes you are targeting (r): write which success you are waiting for.
- Enter the single-trial success probability (p) between 0 and 1; write 0.4 for forty percent.
- Enter the number of failures (k) whose probability you want; the total number of trials is shown automatically as k + r.
- If you like, set the interval bounds (a and b); leaving the upper bound blank computes P(X ≥ a).
- 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.
- 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