Quant Memo
Core

The Negative Binomial Distribution

The distribution for "how many tries until the r-th success" — a geometric distribution stacked r times. It doubles as the go-to fix for count data that's too spread out for a Poisson.

Prerequisites: The Geometric Distribution, The Binomial Distribution

The negative binomial distribution answers a slightly greedier version of the geometric question. Instead of "how many tries until the first success?", it asks "how many tries until the rr-th success?" Keep flipping a coin until you've seen three heads; keep taking trades until you've booked five winners; keep sending quotes until ten of them fill. The total number of attempts is negative binomial, and when r=1r = 1 it collapses straight back to the The Geometric Distribution.

Each attempt is an independent success-with-probability-pp trial. To have the rr-th success land on trial number kk, two things must happen: exactly r1r - 1 of the first k1k - 1 trials succeed (in any order), and the kk-th trial is the final success. That gives

P(X=k)=(k1r1)pr(1p)kr,k=r,r+1,r+2,P(X = k) = \dbinom{k-1}{\,r-1\,}\, p^{\,r}\, (1 - p)^{\,k - r}, \qquad k = r, r+1, r+2, \dots

The symbols: XX is the trial on which the rr-th success occurs, rr is how many successes you're waiting for, pp is the per-trial success probability, and (k1r1)\binom{k-1}{r-1} counts the ways to arrange the earlier successes. You can't finish before trial rr, so the counts start at k=rk = r.

3 4 5 6 7 8 9 10 11 12 mean = r/p = 6 NegBinom(r = 3, p = 0.5)
Waiting for the 3rd success with a fair coin: unlike the ever-shrinking geometric, the mound now peaks away from the start (you can't finish before trial 3) and trails off to the right, with the mean r/p = 6 sitting in the tail.

Mean and variance: geometric, times r

Because reaching the rr-th success is just rr separate first-success waits laid end to end, the mean and variance are simply rr copies of the geometric's:

E[X]=rp,Var(X)=r(1p)p2.E[X] = \frac{r}{p}, \qquad \operatorname{Var}(X) = \frac{r(1 - p)}{p^2} .

Waiting for the first success takes 1/p1/p tries on average, so waiting for rr of them takes r/pr/p, no derivation needed once you see it as stacked geometric waits.

The negative binomial is a stack of rr geometric waits: expected tries to the rr-th success is r/pr/p, and its variance is rr times the geometric's. Set r=1r = 1 and you recover the The Geometric Distribution exactly.

Worked example

You flip a fair coin (p=0.5p = 0.5) until you've collected three heads (r=3r = 3).

  • Expected number of flips: E[X]=r/p=3/0.5=6E[X] = r/p = 3/0.5 = 6.
  • Chance the third head lands on flip 5: you need exactly 2 heads among the first 4 flips, then a head,
P(X=5)=(42)(0.5)3(0.5)2=6×(0.5)5=632=0.1875.P(X = 5) = \dbinom{4}{2}(0.5)^3(0.5)^2 = 6 \times (0.5)^5 = \frac{6}{32} = 0.1875 .
  • Chance you finish in the minimum 3 flips (three heads straight):
P(X=3)=(22)(0.5)3=(0.5)3=0.125.P(X = 3) = \dbinom{2}{2}(0.5)^3 = (0.5)^3 = 0.125 .

So six flips on average, but a healthy chance of finishing early, and a long right tail of unlucky runs that drags the mean above the peak.

The other life: modelling overdispersed counts

Here's the twist that makes the negative binomial a workhorse in statistics. The The Poisson Distribution insists that a count's mean and variance be equal. Real count data, defaults, order arrivals, insurance claims, is often overdispersed: its variance sits well above its mean because events cluster. Reparameterise the negative binomial by its mean and it becomes a Poisson whose rate is itself random (a Poisson–gamma mixture), giving you a spare knob to widen the variance independently of the mean. That flexibility is exactly why it's the standard replacement for the Poisson when counts are too bursty.

If your count data's variance is well above its mean, don't force a Poisson, fit a negative binomial. Its extra dispersion parameter lets the spread exceed the mean, which the Poisson structurally forbids.

Conventions differ: some texts count total trials to the rr-th success (support r,r+1,r, r+1, \dots, mean r/pr/p), others count failures before it (support 0,1,0, 1, \dots, mean r(1p)/pr(1-p)/p). Same distribution, shifted by rr, always check which one a formula or library assumes.

The negative binomial ties the family together: it generalises the The Geometric Distribution (r=1r = 1), mirrors the The Binomial Distribution with the roles of trials and successes swapped, and rescues you when the The Poisson Distribution is too rigid, one of the Common Distributions worth carrying in both of its guises.

Related concepts

Practice in interviews

Further reading

  • Blitzstein & Hwang, Introduction to Probability, ch. 4
  • Casella & Berger, Statistical Inference (ch. 3)
ShareTwitterLinkedIn