Negative Binomial Distribution Calculator

Negative Binomial Calculator

Find how many attempts it takes to reach a target number of successes: the chance the r-th success lands on a given trial, comes within it, or needs longer.

P(X = x) = C(x − 1, r − 1) pʳ (1 − p)ˣ⁻ʳ

x counts every attempt, successes and failures, up to and including the r-th success. With r = 1 this is the geometric distribution.

Enter the successes needed, the chance of success and a trial number

What is the Negative Binomial Distribution?

The negative binomial distribution counts how many attempts it takes to reach a set number of successes. The binomial fixes the attempts and counts successes; this fixes the successes and counts attempts.

Sales calls until three deals close, free throws until the third basket, or wells drilled until two strike oil all fit, as long as each attempt is independent with the same chance of success.

With a target of a single success it becomes the geometric distribution. It's also widely used for counts that vary more than a Poisson model allows, such as hospital visits or insurance claims.

Negative Binomial Formula

Trials-until-r-successes form, as in Blitzstein and Hwang, section 4.3. See Sources.

1. The last trial must be a success

Arrange the other r − 1 successes among the first x − 1 trials: C(x − 1, r − 1) ways

2. Multiply by the chance of each arrangement

P(X = x) = C(x − 1, r − 1) × pʳ × (1 − p)ˣ⁻ʳ

3. Cumulative chance, mean and spread

P(X ≤ x) = P(at least r successes in x trials)
mean = r ÷ p · variance = r(1 − p) ÷ p²

Worked Example: The Third Free Throw

Given:
A player makes 70% of free throws. What's the chance the 3rd basket comes on the 5th attempt?
Step 1:
2 baskets among the first 4 attempts:
C(4, 2) = 6 arrangements
Step 2:
Each arrangement, with a basket on the 5th:
0.7³ × 0.3² = 0.343 × 0.09 = 0.03087
Step 3:
Multiply:
6 × 0.03087 = 0.1852
Result:
P(3rd basket on the 5th throw) = 18.5%

Getting all three by the 5th throw is far more likely, at 83.7%. On average the player needs 3 ÷ 0.7 ≈ 4.3 throws.

Waiting for a First Success at 20%

r = 1 (the geometric case), p = 0.2: for example, a sales call that closes one time in five.

Chance of the first success on and by each attempt
AttemptFirst success on itBy then
120%20%
216%36%
312.8%48.8%
58.19%67.23%
102.68%89.26%
150.88%96.48%
200.29%98.85%

Common Negative Binomial Mistakes

  • Mixing the two conventions. Some books count total trials (x ≥ r), others count only failures (x − r). Excel's NEGBINOM.DIST counts failures.
  • Using C(x, r) instead of C(x − 1, r − 1). The final trial is fixed as a success, so only the earlier ones can be rearranged.
  • Expecting the r-th success on trial r ÷ p. That's the average. The most likely trial is earlier, and the distribution has a long right tail.
  • Assuming a constant chance. If success gets easier with practice or harder with fatigue, the model doesn't apply.

Negative Binomial FAQs

Why is it called “negative” binomial?

Its probabilities are the terms of a binomial series with a negative exponent. The name is historical rather than descriptive.

What is the geometric distribution?

The special case r = 1: the number of attempts until the first success. Its mean is 1 ÷ p.

How do I calculate it in Excel?

=NEGBINOM.DIST(x − r, r, p, FALSE), where x − r is the number of failures. Use TRUE for the cumulative chance.

How does “within x trials” relate to the binomial?

Reaching r successes within x trials is the same event as getting at least r successes in x trials, so the two calculators agree.

Why is it used for overdispersed counts?

Its variance exceeds its mean, so it fits counts that bunch together, like hospital visits, better than a Poisson model.

What’s the chance I never succeed?

Zero, as long as p is above 0. The chance of needing more than x trials always shrinks towards zero as x grows.

Can p be 100%?

Yes. Then the r-th success comes on trial r with certainty.

How many trials do I need to be 95% sure of r successes?

Increase x until “within x trials” reaches 95%. For the free-throw example, three baskets are 95% likely within 7 throws.

Sources

Related Tools