Skip to content
Omnikalc

Negative binomial distribution: trials needed for r successes

Get the probability that the r-th success happens on trial k, by trial k or later, with the mean and variance of the number of trials.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Results

P(X = k): r-th success exactly on trial k

0.10451

P(X ≤ k): r successes within k trials

0.68461

P(X > k)
0.31539
Mean number of trials r ÷ p
7.5
Variance r(1 − p) ÷ p²
11.25
Mean number of failures before the r-th success
4.5

The negative binomial distribution

The negative binomial distribution, also called the Pascal distribution, generalizes the geometric distribution: it describes the number of independent trials needed to get r successes, each trial having the same probability of success p. How many free throws until the third basket? How many calls to close five sales? How many wells to drill before three strike oil?

The formulas

With X the number of trials needed for the r-th success:

  • P(X = k) = C(k − 1, r − 1) × pʳ × (1 − p)^(k − r), for k ≥ r;
  • P(X ≤ k) = probability of at least r successes in k trials, computed with the binomial distribution;
  • mean r ÷ p, variance r(1 − p) ÷ p².

The term C(k − 1, r − 1) counts the ways to place the first r − 1 successes among the first k − 1 trials, since the last trial must be the r-th success.

Example

You need r = 3 successes, each trial succeeding with probability p = 0.4:

  • third success exactly on trial 8: C(7, 2) × 0.4³ × 0.6⁵ = 21 × 0.064 × 0.0778 ≈ 0.105;
  • three successes within 8 trials: ≈ 0.685;
  • needing more than 8 trials: ≈ 0.315;
  • mean of 7.5 trials, with 4.5 failures on average, and a variance of 11.25.

Two conventions

Some textbooks and software count the number of failures before the r-th success instead of trials. The two differ by r: failures = trials − r. Check which one your source uses. In R, for example, dnbinom counts failures.

Uses in statistics

Beyond waiting times, the negative binomial is the standard model for overdispersed count data: counts whose variance exceeds their mean, such as the number of doctor visits per person, accidents per driver or insects per plant. The Poisson distribution forces variance to equal the mean. The negative binomial adds a dispersion parameter, which is why negative binomial regression is widely used in epidemiology, ecology and insurance.

  • With r = 1, the negative binomial reduces to the geometric distribution.
  • The binomial distribution fixes the number of trials and counts successes; the negative binomial fixes the successes and counts trials.
  • The sum of r independent geometric variables with the same p follows a negative binomial distribution.

Frequently asked questions

What is the negative binomial distribution?

It gives the probability that the r-th success occurs on a given trial, or after a given number of failures.

How is it related to the geometric distribution?

The geometric distribution is the special case with r = 1.

What is its mean?

r/p trials, or r(1 - p)/p failures before the r-th success.

Where is it used?

Sales calls until r deals, quality control, and count data with more variance than a Poisson model.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.