Negative Binomial Distribution Calculator
Test cases replayed : 3 of 3 match · Methodology · No outside source listed
Enter the number of successes you wait for, the probability of success per trial and a number of failures k.
Result
P(exactly k failures)
P(at most k failures)
- P(more than k failures)
- Total trials in this case (k + r)
- Mean number of failures
- Variance
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Successes wanted (r): enter 1 or more.
- Probability of success per trial (0 to 1): enter a number from 0 to 1.
- Failures before the r-th success (k): enter 0 or more.
- Read the result: P(exactly k failures); the panel also shows P(at most k failures), P(more than k failures), Total trials in this case (k + r), Mean number of failures and Variance.
How this calculator works
Negative binomial distribution, counting the failures X before the r-th success in independent trials with success probability p: P(X = k) = C(k + r − 1, k) × p^r × (1 − p)^k.
P(X ≤ k) equals the probability of at least r successes in k + r trials, 1 − B(r − 1; k + r, p) with B the binomial cumulative distribution. Mean = r(1 − p) ÷ p, variance = r(1 − p) ÷ p².
Other texts count total trials N = X + r instead; the probabilities are the same, shifted by r. With r = 1 this is the geometric distribution.
The formula
| Symbol | Meaning |
|---|---|
| Successes wanted | |
| Probability of success per trial (0 to 1) | |
| Failures before the r-th success | |
| P(exactly k failures) | |
ncr(n, k) | the number of ways to choose k items from n, order ignored. |
Worked example
| Successes wanted (r) | 3 |
|---|---|
| Probability of success per trial (0 to 1) | 0.4 |
| Failures before the r-th success (k) | 4 |
| P(at most k failures) | 0.5801 |
|---|---|
| P(more than k failures) | 0.4199 |
| Total trials in this case (k + r) | 7 |
| Mean number of failures | 4.5 |
| Variance | 11.25 |
P(exactly k failures) 0.1244
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
What is the chance of the 3rd success coming after exactly 4 failures when p = 0.4?
C(6, 4) × 0.4³ × 0.6⁴ = 15 × 0.064 × 0.1296 ≈ 0.1244, on trial 7.
How is it related to the binomial distribution?
The binomial fixes the number of trials and counts successes; the negative binomial fixes the number of successes and counts the failures needed to reach it.