Negative Binomial Distribution

Model the number of trials required to achieve a fixed number of successes, or the number of failures before the r‑th success. Essential for overdispersed count data and waiting‑time problems.

PMF (trials form): P(X = k) = C(k-1, r-1) · pr · (1-p)k-r

where k = r, r+1, r+2, … (k total trials, r successes, p success probability).

Alternative definition (failures form): Y = k‑r failures, P(Y=y) = C(y+r-1, y) · pr · (1-p)y. This calculator uses the trials version.

r ≥ 1, integer
0 < p ≤ 1
k ≥ r
Valid trials: k ≥ 5
⚾ Baseball: r=3,p=0.5,k=6
? Defects: r=2,p=0.2,k=10
? Geometric: r=1,p=0.3,k=4
? Dice: r=4,p=0.6,k=7
? Overdispersed: r=5,p=0.25,k=20
Negative Binomial Results (trials form)
P(X = 10) = 0.10032906
P(X ≤ 10) = 0.36689674
C(9,4) · 0.4^5 · 0.6^5 = 0.10032906
12.5000
Mean (μ)
18.750000
Variance (σ²)
4.330127
Std Dev (σ)
5 … ∞
Support
PMF: P(X = k)
Selected k = 10

* PMF shown for k from r to an upper limit (≈ mean+5σ). Probabilities for large k are very small.

Understanding the Negative Binomial Distribution

The negative binomial distribution models the number of independent Bernoulli trials required to obtain a fixed number of successes r. It generalizes the geometric distribution (r=1). Two common parameterizations exist:

  • Trials form (X = total trials): P(X = k) = C(k-1, r-1) pr (1-p)k-r, k = r, r+1, …
  • Failures form (Y = failures before r-th success): P(Y = y) = C(y+r-1, y) pr (1-p)y, y = 0,1,2,…

This calculator uses the trials form (Pascal). The distribution is widely used for overdispersed count data where variance exceeds the mean.

Key Properties
  • Mean: μ = r / p
  • Variance: σ² = r(1-p) / p²
  • Variance > mean (overdispersion) when p < 1
  • As r → ∞, p → 1 appropriately, approximates Poisson
  • Special case r = 1 ⇒ geometric distribution
Real‑World Applications
  • Insurance: Number of claims until r‑th accident
  • Epidemiology: Number of contacts until r‑th infection
  • Quality control: Items inspected until r‑th defect
  • Sports: At‑bats until r‑th hit
  • Ecology: Counts of rare species (overdispersion)

Why "Negative" Binomial? The name derives from the binomial series with a negative exponent: (1-p)-r = Σ C(k-1, r-1) pr (1-p)k-r. The coefficients appear in the expansion of (1-p)-r.

Connection to Poisson‑Gamma mixture: The negative binomial can be derived as a Poisson distribution whose rate parameter follows a Gamma distribution — a popular model for overdispersed counts.

Frequently Asked Questions (6 items)

Use negative binomial when the count data exhibit overdispersion (variance > mean). Poisson assumes variance = mean. Negative binomial has an extra dispersion parameter and provides a better fit for many biological, ecological, and insurance datasets.

If you count the total number of trials until the r‑th success, the support is k = r, r+1,… . If you count only the failures before the r‑th success, support is y = 0,1,2,… . They are related by y = k‑r. This calculator presents the trials form, but you can easily convert.

Yes, the negative binomial distribution can be generalized to real r > 0 (often used in regression). The PMF then involves the Gamma function. This calculator requires integer r (≥1) for simplicity and clarity.

P(X ≤ k) is the sum of PMF from k = r to the specified k. The calculator automatically performs this summation and displays the result. For large k, probabilities approach 1.

When p → 0, the mean becomes huge and the distribution is extremely right‑skewed. When p = 1, the distribution is degenerate at k = r (always exactly r trials). The calculator handles 0 < p ≤ 1; p = 1 gives PMF = 1 only for k = r.

Yes — the binomial counts successes in a fixed number of trials; the negative binomial counts trials needed to obtain a fixed number of successes. The coefficients are similar but with a different combinatorial interpretation.