Negative Binomial Distribution Calculator
Find the chance of a set number of failures before reaching a target number of successes.
What it does
The negative binomial distribution answers a different question from the ordinary binomial. Instead of fixing the number of trials and counting successes, it fixes the number of successes you need and counts how many failures occur along the way. A sales team that keeps calling until it closes three deals is a typical example.
This page counts failures only, starting at zero. If you need the total number of trials, add the required successes to the failure count. Both forms describe the same process, and the tool states the relationship so the two conventions stay easy to tell apart.
The chance of exactly y failures before success number r combines a binomial coefficient with the chance of r successes and y failures. The last trial must succeed, which is why the coefficient uses r plus y minus one rather than r plus y.
Like the geometric distribution, this model needs independent trials with one constant success chance. It is useful for quality testing, sports streaks and any setting where you continue until a target is met rather than stopping at a preset time.
How to use
- Choose whether you want an exact failure count, a cumulative chance or an interval.
- Enter the number of successes that ends the process.
- Enter the failure count y, which may be zero.
- For an interval, enter a second failure count at or above y.
- Enter the chance that one trial succeeds, as a percent.
- Read the probability and compare the mean with your intuition.
Formula
- r
- Number of successes required to stop, a positive whole number.
- y
- Failures observed before the r-th success.
- p
- Success chance on one trial, entered as a percent.
- C(y + r - 1, y)
- Number of ways to arrange the failures among the earlier trials.
Cumulative probabilities use the regularized incomplete beta relationship and are computed directly by the engine, so no long summation is needed. If you count all trials instead of failures, the count starts at r, the mean becomes r/p and the variance stays the same. At a 100% success chance there are no failures and the mean is zero.
Worked example
Example: 3 successes, 2 failures, 40% chance
Need r = 3 successes, observe y = 2 failures, with a 40% chance of success on each trial.
- Success chance p = 0.4 and failure chance 0.6.
- Arrangements: C(2 + 3 - 1, 2) = C(4, 2) = 6.
- Success part: 0.4 cubed = 0.064.
- Failure part: 0.6 squared = 0.36.
- Multiply: 6 x 0.064 x 0.36 = 0.13824, shown as 0.1382 (13.82 %).
- Mean failures: 3 x 0.6 / 0.4 = 4.5.
- Variance: 3 x 0.6 / 0.16 = 11.25, giving a standard deviation of 3.3541.
Reference table
| Failures y | P(Y = y) | P(Y <= y) |
|---|---|---|
| 0 | 0.0640 (6.40 %) | 0.0640 (6.40 %) |
| 2 | 0.1382 (13.82 %) | 0.3174 (31.74 %) |
| 4 | 0.1244 (12.44 %) | 0.5801 (58.01 %) |
Limits
- Needs independent trials with a constant success chance.
- Does not impose a maximum number of failures.
- Counts failures only, so total trials require adding r.
- Assumes the process stops exactly when the target success count arrives.
Common mistakes
- Using C(y + r, y) instead of C(y + r - 1, y).
- Adding r to the failure count and then using the failure mean.
- Starting the failure count at 1 instead of 0.
- Entering the success chance as 40 rather than 40%.
- Applying the model when the chance changes after each attempt.
Try it yourself
Quick checks. Answers sit tucked under each question.
Before 3 successes at 40%, what is the chance of at most 2 failures?
0.3174 (31.74 %).
Before 3 successes at 40%, what is the chance of 1 to 3 failures?
0.3917 (39.17 %).
What are the mean and spread in this example?
Mean 4.5 failures and standard deviation 3.3541.
Questions
How is this different from the binomial distribution?
Binomial fixes the trial count and counts successes. This page fixes the success target and counts failures.
Why does the geometric page use trials and this one use failures?
It is a convention choice. Geometric with one success and failures counted is the r = 1 case here.
How do I get total trials?
Add r to the failure count. Three successes with two failures took five trials.
Can the failure count be zero?
Yes. It means every trial succeeded until the target was reached.
What if success becomes more likely over time?
The fixed chance assumption fails, so this formula no longer describes the process.
Is this also called the Pascal distribution?
Yes, Pascal and Polya are alternate names used in some texts for the same family.
Sources
- National Taiwan University, Statistical Inference lecture notes
- Penn State STAT 414, Lesson 11: Geometric and Negative Binomial Distributions