Negative Binomial Distribution Calculator
- Ways to arrange the failures before the final, r-th success: C(4, 2) = 6.
- Probability: 6 × 0.50^3 × 0.50^2 = 18.75%.
- On average the 3-th success arrives after 3.00 failures, with a variance of 6.00. With r = 1 this reduces to the geometric distribution.
The negative binomial distribution calculator gives the probability of exactly k failures before the r-th success in independent trials with success probability p. The formula is P = C(k + r − 1, k) × p^r × (1 − p)^k. For example, exactly 2 failures before the 3rd success at p = 50% has probability 18.75%, with C(4, 2) = 6 arrangements. Exactly 5 failures before the 5th success at p = 40% has probability 10.03%; the expected failure count is 7.50 and the variance 18.75. With r = 1 and p = 25%, exactly 4 failures before the first success has probability 7.91% — the geometric distribution special case. The expected number of failures before the r-th success is r(1 − p)/p and the variance is r(1 − p)/p². Typical uses include sales calls needed to close r deals, inspection sampling until the r-th defective, and innings until a bowler's r-th wicket.
The negative binomial distribution is the accepted standard for calculating the probability of a target number of successes in independent trials because it directly models the count of failures before a fixed success threshold. Unlike approximations, it preserves the exact combinatorial structure of trial sequences, producing precise probabilities and moments for any valid parameter combination. This page shows the formula, step-by-step workings, worked examples and sources so you can verify each result and apply the method with confidence.
Worked examples
A fair coin
Primary result: 18.75% — exactly 2 failures before the 3rd success at 50% per flip. (3 · 2 · 50 %)
| Negative binomial probability | 18.75% |
| Combinations C(k + r − 1, k) | 6 |
| Expected failures before the r-th success | 3.00 |
| Variance of the failure count | 6.00 |
A 40% close rate
Primary result: 10.03% — exactly 5 failures before the 5th success; the expected failure count is 7.50. (5 · 5 · 40 %)
| Negative binomial probability | 10.03% |
| Combinations C(k + r − 1, k) | 126 |
| Expected failures before the r-th success | 7.50 |
| Variance of the failure count | 18.75 |
The geometric special case
Primary result: 7.91% — with r = 1 the negative binomial becomes the geometric distribution. (1 · 4 · 25 %)
| Negative binomial probability | 7.91% |
| Combinations C(k + r − 1, k) | 1 |
| Expected failures before the r-th success | 3.00 |
| Variance of the failure count | 12.00 |
What the negative binomial counts
The negative binomial distribution gives the probability of exactly k failures before the r-th success in independent trials with success probability p. The formula is P = C(k + r − 1, k) × p^r × (1 − p)^k, where C(k + r − 1, k) counts the number of ways those k failures and r − 1 prior successes can be arranged before the final, r-th success closes the sequence. A negative binomial distribution calculator applies this formula directly, so you can find probabilities without working through the combinatorics by hand.
The key contrast with the ordinary binomial is what each distribution treats as fixed. A binomial distribution fixes the number of trials and counts how many successes occur within them. The negative binomial flips that logic: it fixes the number of successes and counts how many failures happen along the way. This distinction matters whenever you are waiting for a milestone rather than running a preset number of attempts.
The formula's pieces become easier to read through a concrete example. For exactly 2 failures before the 3rd success at p = 50%, the probability is 18.75%. Here C(4, 2) = 6 arrangements of the two failures among the first four outcomes, each arrangement weighted by p^3 × (1 − p)^2. A larger case: exactly 5 failures before the 5th success at p = 40% has probability 10.03%. In that same scenario the expected failure count is 7.50 and the variance is 18.75, showing how spread and typical value can differ even when a specific outcome has a modest probability.
The distribution also includes a well-known special case. With r = 1 and p = 25%, exactly 4 failures before the first success has probability 7.91% — this is the geometric distribution, which counts failures before a single success. Setting r = 1 in the general formula collapses it to that simpler form, so the geometric sits inside the negative binomial family rather than alongside it.
Beyond the formula, the expected number of failures before the r-th success is r(1 − p)/p and the variance is r(1 − p)/p². These moments help you plan around the distribution, not just calculate point probabilities. Practical settings where this framing fits naturally include:
- Sales calls needed to close r deals, where each call either succeeds or fails and you stop once the target is reached.
- Inspection sampling until the r-th defective item is found, rather than inspecting a fixed batch and counting defects.
- Innings until a bowler's r-th wicket, where each delivery can be treated as a trial with some wicket probability.
Worked examples
The table below shows three verified cases that a negative binomial distribution calculator should reproduce exactly. Each row applies the formula P = C(k + r − 1, k) × p^r × (1 − p)^k, where k is the number of failures before the r-th success in independent trials with success probability p. The expected number of failures before the r-th success is r(1 − p)/p, and the variance is r(1 − p)/p².
The first case demonstrates the most common textbook scenario: exactly 2 failures before the 3rd success at a success probability of 50%. The combination C(4, 2) = 6 gives the number of distinct arrangements of those failures and successes, yielding a probability of 18.75%. The second case shifts to a lower success rate of 40%, asking for exactly 5 failures before the 5th success. Here the expected failure count rises to 7.50 and the variance reaches 18.75, reflecting greater spread when success is less likely.
The third case is a geometric distribution special case with r = 1 and p = 25%. Calculating exactly 4 failures before the first success produces a probability of 7.91%. Because only one success is required, the combination term simplifies and the distribution reduces to its geometric form. This special case is useful for modeling the waiting time until a single event occurs.
These same calculations apply to real-world counting problems such as sales calls needed to close r deals, inspection sampling until the r-th defective item, and innings until a bowler's r-th wicket. In each situation, the negative binomial framework answers the question of how many failures you should expect before reaching a target number of successes.
| Case description | k (failures) | r (successes) | p (success probability) | Combinations C(k + r − 1, k) | Probability | Expected failures | Variance |
|---|---|---|---|---|---|---|---|
| Exactly 2 failures before the 3rd success | 2 | 3 | 50% | C(4, 2) = 6 | 18.75% | — | — |
| Exactly 5 failures before the 5th success | 5 | 5 | 40% | — | 10.03% | 7.50 | 18.75 |
| Exactly 4 failures before the 1st success (geometric special case) | 4 | 1 | 25% | — | 7.91% | — | — |
Negative binomial vs geometric and Poisson
The negative binomial distribution has a close relationship with two other probability distributions that count successes or failures. When you set r equal to 1 in the formula, the negative binomial simplifies to the geometric distribution. That special case asks for the probability of exactly k failures before the first success, rather than before the r-th success. Our negative binomial distribution calculator handles this automatically — enter r = 1 and the tool produces the geometric result.
A verified example shows this special case in action. With r = 1 and p = 25%, the probability of exactly 4 failures before the first success is 7.91%. That single number is what the geometric distribution gives you when you care only about how long it takes to get one success. The negative binomial generalizes the same idea to any number of required successes, which makes it the more flexible tool for real-world counting problems.
The negative binomial is also related to the Poisson distribution, another great counting distribution. Both distributions model the number of events, but they differ in their assumptions. The Poisson distribution describes the number of events in a fixed interval, with a constant average rate. The negative binomial, by contrast, counts the number of failures before a target number of successes in independent trials with a known success probability. In many practical settings the negative binomial provides a better fit than the Poisson because it can model data where the variance exceeds the mean. The expected number of failures before the r-th success is r(1 − p)/p, and the variance is r(1 − p)/p². Because the variance includes an extra factor of 1/p compared with the mean, the negative binomial can capture more variability than the Poisson, which assumes the mean and variance are equal.
These properties explain why the negative binomial distribution calculator is useful across different fields. The formula P = C(k + r − 1, k) × p^r × (1 − p)^k gives the exact probability for any combination of k, r, and p, and the relationships with the geometric and Poisson distributions help you choose the right model for your data.
- Typical uses for the negative binomial distribution include sales calls needed to close r deals, inspection sampling until the r-th defective item, and innings until a bowler's r-th wicket.
When the model breaks
The negative binomial distribution rests on two assumptions that are easy to state but hard to guarantee in real data: every trial must be independent of the others, and the success probability p must stay constant from the first trial to the last. When those assumptions hold, the formula P = C(k + r − 1, k) × p^r × (1 − p)^k gives you a clean, reliable probability for exactly k failures before the r-th success. When they do not hold, the same formula can produce numbers that look precise but are misleading. A negative binomial distribution calculator will still return a result, but that result is only as trustworthy as the assumptions behind it.
Streaky processes are one common way the model breaks. Suppose you are tracking innings until a bowler's r-th wicket, one of the typical uses for this distribution. If a bowler gains confidence after taking a wicket and becomes more likely to take the next one, p is no longer constant — it rises with each success. The trials are also not independent, because one success changes the conditions of the next. The same problem appears in sales calls needed to close r deals when a rep gets into a rhythm: the probability of closing on any single call shifts as the day goes on, and the calculator's output drifts away from reality.
Learning processes violate the assumptions in the opposite direction. In inspection sampling until the r-th defective, an assembly line operator who spots a defect may adjust the machine, making later defects less likely rather than equally likely. Here p falls over time instead of holding steady. The expected number of failures before the r-th success, r(1 − p)/p, and the variance, r(1 − p)/p², both assume a fixed p. Once p starts moving, those benchmarks no longer apply. A process that looked like it should average 7.50 failures before the 5th success at p = 40% may actually produce far fewer failures once learning kicks in, because the underlying probability has changed mid-stream.
Before you trust any output from a negative binomial distribution calculator, ask whether the process you are measuring resets cleanly after each trial. If a success or failure leaves no residue — no new skill, no fatigue, no changed odds — the model fits. If it does leave a residue, the distribution becomes a rough approximation at best and a wrong answer at worst.
- Trials must be independent: the outcome of one cannot change the odds of the next.
- Success probability p must be constant: it cannot drift up with momentum or down with learning.
- Streaky behavior raises p after successes; learning behavior lowers p after adjustments — both break the model.
- If either assumption fails, the expected value r(1 − p)/p and the variance r(1 − p)/p² no longer describe the real process.
FAQs
How is the negative binomial probability calculated?
The negative binomial probability is calculated using the formula C(k + r − 1, k) × p^r × (1 − p)^k. For example, calculating 2 failures before the 3rd success at a 50% success rate gives 6 × 0.125 × 0.25 = 18.75%.
What is the expected number of failures?
The expected number of failures is calculated as r(1 − p)/p. For example, at a 40% success rate, you would see 7.50 failures on average before the 5th success.
How is the negative binomial different from the binomial?
The binomial distribution fixes the number of trials and counts the successes within them. The negative binomial distribution reverses this logic: it fixes the number of successes and counts the failures, or total trials, needed to reach that target.
What is the geometric distribution?
The geometric distribution is the special case where r = 1, representing failures before the first success. For example, at p = 25%, the probability of exactly 4 failures before the first success is 7.91%.
Can k be zero?
Yes, k can be zero. This represents succeeding r times in a row, which has a probability of p^r. The formula correctly returns this value because C(r − 1, 0) equals 1, simplifying the calculation to just p^r.
Where is the negative binomial used?
The negative binomial distribution is used in sales and call-centre planning, reliability testing, and epidemiology count data. It applies to any process where outcomes are counted until a target number of events is reached.