Negative Binomial Distribution Calculator
Probability that the r-th success happens on trial x: P(X = x), P(X ≤ x) and P(X ≥ x) for the negative binomial distribution, with its mean, variance and a probability table.
How it works
P(X = x) = C(x − 1, r − 1) · pʳ · (1 − p)ˣ⁻ʳ, x = r, r+1, … · mean r/p · variance r(1 − p)/p² · P(X ≤ x) = I_p(r, x − r + 1)
The negative binomial distribution counts how many independent trials it takes to reach the r-th success when each trial succeeds with probability p. The last trial must be a success, and the other r − 1 successes can be anywhere among the first x − 1 trials, which gives the binomial coefficient C(x − 1, r − 1). With r = 1 it reduces to the geometric distribution. Some textbooks count failures before the r-th success instead; that is simply x − r.
Worked example
With r = 3 successes needed, p = 0.5 and x = 5 trials: P(X = 5) = C(4, 2) × 0.5³ × 0.5² = 6 × 0.03125 = 0.1875. The probability of needing at most 5 trials is 0.5, the mean is 3/0.5 = 6 trials and the variance is 6.
Sources: Negative binomial distribution — Wikipedia · Negative Binomial Distribution — Wolfram MathWorld
Frequently asked questions
What is the difference between the binomial and negative binomial distributions?
The binomial fixes the number of trials and counts successes. The negative binomial fixes the number of successes and counts the trials needed to reach them.
Trials or failures — which definition is this?
This calculator uses X = number of trials until the r-th success (X ≥ r). If your book uses Y = number of failures, then Y = X − r; enter x = y + r.
How is it related to the geometric distribution?
The geometric distribution is the special case r = 1: the trial on which the first success occurs.
Where is the negative binomial used?
Sales calls until r sales, free throws until r baskets, quality control, and in ecology and insurance as a model for over-dispersed counts (variance larger than the mean).
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.