Negative binomial distribution

Flip a biased coin with success probability until you accumulate exactly successes. The number of failures along the way is negative-binomial distributed.

00.050.10.15024681012141618k (failures before the r-th success)probability
Dark bars: PMF . Light bars: empirical frequencies from 1000 simulated waits. Mean = 4.50.

What to notice

  • Raising shifts mass to the right (you’re waiting for more successes, so more failures pile up) and smooths the shape toward a Normal, since the total is a sum of independent geometric waits.
  • Lowering stretches the whole distribution — rare successes mean long waits.
  • Variance exceeds the mean by a factor of . Compared to Poisson (where variance equals the mean), the negative binomial is overdispersed — which is why it’s the go-to for count data that clumps.

Relationship to other distributions

  • Geometric. With , you’re waiting for the first success, which is exactly the geometric distribution on non-negative integers.
  • Sum of geometrics. More generally, a negative binomial with parameter is the sum of independent geometrics — a discrete cousin of the gamma distribution, which is the sum of exponentials.
  • Poisson-gamma mixture. A Poisson whose rate is itself gamma-distributed integrates out to a negative binomial. That’s the Bayesian reason it’s used whenever Poisson rates vary between observations.