Negative Binomial Distribution Calculator
Find the probability that the r-th success arrives on a given trial—or within a range of trials—and work out how many attempts you need to reach it with a chosen level of certainty.
Trials or failures?
Textbooks usually count the total trials needed for r successes. Excel, R, and Python count the failures before the r-th success. Pick the version that matches your source; the probabilities are the same once you convert with trials = failures + r.
—
—
Mean
—
—
Mode
—
Most likely value
Variance
—
r(1 − p) ÷ p²
Std. Deviation
—
√Variance
Probability Mass Function
—
How it was calculated
All distribution measures
How to Use This Calculator
- Choose Probability to get the chance of a specific outcome, or Trials Needed to find how many attempts give you a target chance of reaching r successes.
- Choose whether to count trials (Y), the attempt on which the r-th success happens, or failures (X) before it.
- Enter the number of successes r and the per-trial success probability p.
- In Probability mode, pick exactly, at most, fewer than, at least, or more than, and enter n (trials) or k (failures). In Trials Needed mode, enter the target probability.
- Press Calculate. The bar chart highlights the outcomes included in the answer, and the step list shows the combination and powers used.
What Is the Negative Binomial Distribution?
A negative binomial distribution calculator calculates the probability of achieving a specified number of successes after a given number of failures in independent trials. The negative binomial distribution uses a constant success probability for each trial. Enter the number of successes, failures, and success probability to calculate the corresponding probability.
The negative binomial distribution, also called the Pascal distribution, reverses the setup of the binomial distribution. A binomial question fixes the number of trials and asks how many successes occur. A negative binomial question fixes the number of successes and asks how many trials, or how many failures, it takes to get there. The last trial is always a success, which is why the counting formula uses n − 1 and r − 1.
Fixed
r successes
You stop as soon as the r-th success happens.
Random
Trials or failures
How long it takes is what varies.
Assumes
Independent trials
Same p every time, no memory between attempts.
Negative Binomial Formula
Counting trials (Y)
P(Y = n) = C(n − 1, r − 1) · pr · (1 − p)n − r
n = r, r + 1, r + 2, …
Counting failures (X)
P(X = k) = C(k + r − 1, k) · pr · (1 − p)k
k = 0, 1, 2, …
The combination C(n − 1, r − 1) = (n − 1)! ÷ [(r − 1)! (n − r)!] counts the ways to place the first r − 1 successes among the first n − 1 trials. The factor pr covers the r successes, and (1 − p)n − r covers the n − r failures. Cumulative probabilities add these terms together; for large values the calculator evaluates them through the regularized incomplete beta function, P(X ≤ k) = Ip(r, k + 1), which gives the same result without summing thousands of terms.
| Measure | Trials (Y) | Failures (X) |
|---|---|---|
| Mean | r ÷ p | r(1 − p) ÷ p |
| Variance | r(1 − p) ÷ p² | r(1 − p) ÷ p² |
| Mode (r > 1) | r + ⌊(r − 1)(1 − p) ÷ p⌋ | ⌊(r − 1)(1 − p) ÷ p⌋ |
| Skewness | (2 − p) ÷ √(r(1 − p)) | |
| Excess kurtosis | 6 ÷ r + p² ÷ (r(1 − p)) | |
Formula reference: Penn State STAT 414 — Negative Binomial Distribution.
Trials vs. Failures: Matching Your Software
Two versions of the same distribution are in common use. Mixing them up shifts every answer by r, so check which one your textbook, spreadsheet, or code library expects.
| Feature | Trials version (Y) | Failures version (X) |
|---|---|---|
| Counts | All trials up to and including the r-th success | Failures before the r-th success |
| Smallest value | r | 0 |
| Conversion | Y = X + r | X = Y − r |
| Typical users | Introductory probability courses | Excel NEGBINOM.DIST, R dnbinom, Python scipy.stats.nbinom |
Example: in Excel, =NEGBINOM.DIST(7, 3, 0.2, FALSE) returns 0.0604—the chance of 7 failures before the 3rd success. That is the same event as the 3rd success landing on trial 10 in the trials version.
Spreadsheet reference: Microsoft Support — NEGBINOM.DIST function.
Worked Example: Sales Calls
A salesperson closes 20% of calls (p = 0.2) and needs 3 sales today (r = 3).
- 3rd sale on exactly the 10th call: C(9, 2) = 36, so P = 36 × 0.2³ × 0.8⁷ = 36 × 0.008 × 0.2097 ≈ 0.0604, or about 6%.
- 3 sales within 10 calls: P(Y ≤ 10) ≈ 0.3222. This equals the binomial chance of at least 3 sales in 10 calls.
- Typical day: 15 calls on average (3 ÷ 0.2), but the most likely finishing calls are the 10th and 11th—tied at about 6% each—and the median is 14.
- Planning with confidence: 25 calls give a 90.2% chance of 3 sales; 24 calls give only 88.5%.
How Many Trials for 3 Successes?
The mean is only the average. For planning, the trial count that gives you 90% or 99% certainty is usually more useful—and it sits well above the mean because the distribution is skewed to the right.
| p per trial | Mean trials | Std. deviation | 50% sure | 90% sure | 99% sure |
|---|---|---|---|---|---|
| 0.5 | 6 | 2.4 | 5 | 9 | 14 |
| 0.2 | 15 | 7.7 | 14 | 25 | 39 |
| 0.1 | 30 | 16.4 | 27 | 52 | 81 |
| 0.05 | 60 | 33.8 | 54 | 105 | 165 |
Halving p doubles the mean, but the 99% column grows even faster in absolute terms. At p = 0.05 you need 165 trials to be nearly certain of 3 successes—almost three times the mean. Use the Trials Needed mode to get the figure for your own r, p, and target.
Related Distributions
Geometric distribution
Set r = 1. The negative binomial becomes the waiting time for the first success, P(Y = n) = p(1 − p)n − 1.
Binomial distribution
Reaching r successes by trial n is the same event as getting at least r successes in n trials: P(Y ≤ n) = P(B ≥ r), where B is binomial with n trials and probability p.
Poisson distribution
If r grows large while the mean number of failures stays fixed, the failures version approaches a Poisson distribution with that mean.
Overdispersed count data
Written with mean m and dispersion r, the failures version has variance m + m² ÷ r—always larger than the mean. That makes it a standard model for counts such as insurance claims, accidents, or disease cases where a Poisson model underestimates the spread.
To fit it to count data from a sample mean m and variance s² (with s² > m), use p = m ÷ s² and r = m² ÷ (s² − m). The resulting r is usually not a whole number, which is valid for the failures version.
Parameterization reference: SciPy documentation — scipy.stats.nbinom.
Negative Binomial vs. Binomial vs. Geometric
All three describe repeated yes/no trials. They differ in what is fixed and what is counted.
| Feature | Binomial | Negative binomial | Geometric |
|---|---|---|---|
| Fixed | Number of trials n | Number of successes r | One success |
| Random | Successes (0 to n) | Trials (r or more) | Trials (1 or more) |
| Mean | np | r ÷ p | 1 ÷ p |
| Typical question | How many sales from 20 calls? | How many calls to make 3 sales? | How many calls to the first sale? |
When the model breaks down
The trials version assumes p stays the same on every attempt and that attempts do not influence each other. Learning effects, fatigue, sampling without replacement from a small population, or success rates that change over the day all violate that assumption and make the calculated probabilities less reliable.
Frequently Asked Questions
Why is it called "negative" binomial?
The name comes from the algebra, not from negative values. The probabilities are the terms of a binomial series with a negative exponent, (1 − q)−r, and each term carries a generalized binomial coefficient. In the ordinary binomial distribution the exponent is positive instead. Every count—and every possible outcome—is zero or positive.
What is the Pascal distribution?
It is another name for the negative binomial distribution with a whole-number r, usually in the trials version, where the random variable is the trial on which the r-th success occurs. Some authors reserve "Pascal" for that case and use "negative binomial" when r may be any positive real number. With r = 1, it reduces to the geometric distribution.
Why does my answer differ from Excel or R?
Excel's NEGBINOM.DIST and R's dnbinom take the number of failures as input, not the number of trials. Switch this calculator to Failures (X), or subtract r from your trial count before entering it into the spreadsheet. Also check the cumulative flag: TRUE returns the cumulative distribution function and FALSE the probability mass function, so make sure that output matches the probability type you selected here.
Why must the number of trials be at least r?
You cannot collect r successes in fewer than r attempts, so that event has a probability of zero. The most favorable sequence—every attempt succeeds—has probability pr, where p is the success probability. From trial r onward, the formula counts the possible arrangements with the combination C(n − 1, r − 1), which is built from factorials: (n − 1)! ÷ [(r − 1)! (n − r)!].
How do I find the number of trials needed for a given chance of success?
Use the Trials Needed mode. It searches for the smallest n with P(Y ≤ n) at or above your target, then reports the probabilities at n and n − 1 so you can see how sharp the cutoff is. This is useful when planning an experiment or campaign: the answer is usually well above the mean—in the planning table above, the 90% figure sits roughly 1.2 to 1.3 standard deviations higher.
Can the distribution have two modes?
Yes. When (r − 1)(1 − p) ÷ p is a whole number, two neighboring values share the highest probability. For example, r = 3 and p = 0.5 give equal probabilities for finishing on trial 4 and trial 5. The calculator lists both values when this happens. Note that the mode is the single most likely value and is usually lower than the expected value r ÷ p.
What if p changes from trial to trial?
Then the negative binomial formula no longer applies exactly, because it treats every attempt as an independent Bernoulli trial with the same p. If p varies a little around a stable average, the probability model is still a reasonable approximation, and you can estimate p from the observed frequency of successes. If it trends up or down, simulate the process or split it into periods with their own p.
Can r be a decimal?
In the success-counting interpretation, no—r is a number of successes. In count-data modeling, the failures version is often fitted with a non-integer r as a dispersion parameter, chosen so the model's variance matches the spread seen in a sample and, by extension, the wider population. This calculator accepts whole numbers only, because it is built around the waiting-time interpretation.
Other Useful Calculators
Lognormal Distribution Calculator
Probabilities, quantiles, and measures for skewed data.
Empirical Rule Calculator
Find the 68–95–99.7% ranges of a normal distribution.
Elimination Method Calculator
Solve two-variable linear systems step by step.
Polynomial Division Calculator
Find a polynomial quotient and remainder.
Complex Root Calculator
Calculate roots involving complex numbers.
Resultant Velocity Calculator
Combine components to find resultant motion.