From shooting free throws to overdispersed counts
Picture shooting free throws until you sink 3 baskets. Some days the makes come fast; some days you brick a pile of shots first. The question "how many misses stack up before my 3rd make?" is exactly what the negative binomial counts. There is no single answer — it is random — so we describe it with a probability for each possible number of misses.
Each shot is a trial that succeeds with probability $p$, and we keep going until we collect $r$ successes. Let $X$ be the number of failures that happen along the way. When $r=1$ this is just "how many misses before the very first make" — the geometric distribution. The negative binomial is simply the geometric idea repeated until the $r$-th success.
To get exactly $k$ failures, you need $k$ misses and $r$ makes in some order, with the last shot being a make. Counting the orderings gives $P(X=k)=\binom{k+r-1}{k}(1-p)^k p^r$. Try a 40%-shooter ($p=0.4$) waiting for $r=3$ makes, asking for $k=3$ misses: $\binom{5}{3}(0.6)^3(0.4)^3 = 10\times0.216\times0.064 \approx 0.138$ — about a 1-in-7 chance.
On average you expect $E[X]=r(1-p)/p$ failures (here $3\times0.6/0.4=4.5$ misses), spread out with variance $\text{Var}(X)=r(1-p)/p^2$. The decisive fact: $\text{Var}/\text{Mean}=1/p>1$, so the spread always exceeds the mean. That property is called overdispersion, and it is why the negative binomial beats the Poisson (which forces $\text{Var}=\text{Mean}$) for real count data that clusters. In the sim, the $r$ slider sets how many successes you wait for, $p$ sets the per-shot success chance, and $k$ picks which outcome you query.
Set $r=1$ and watch the PMF collapse into a pure geometric decay. Then push $p$ toward $0.95$ and see the bars pile up near zero; drop $p$ to $0.1$ and watch a long right tail stretch out. Finally open the vs Poisson tab: both curves share the same mean, but the negative binomial's tail is visibly fatter — that extra width is overdispersion you can see.
Negative Binomial — Number of failures before r-th success
$$\boxed{P(X=k)=\binom{k+r-1}{k}(1-p)^k p^r,\quad k=0,1,2,\ldots}$$
$E[X]=r(1-p)/p,\quad\text{Var}(X)=r(1-p)/p^2$
NegBin(1,p) = Geometric(p). NegBin(r,p) = sum of r independent Geometric(p) variables. As r→∞ with r(1-p)/p = λ fixed: NegBin(r,p) → Poisson(λ). The Negative Binomial has Var > Mean (overdispersion), unlike Poisson where Var = Mean. This is why NegBin is used for overdispersed count data.
For NegBin: Var/Mean = $1/p > 1$ always. This is the Negative Binomial's most important applied property: it models count data where the variance exceeds the mean. The Poisson assumes Var=Mean. Real-world count data almost always has Var > Mean (clustering, heterogeneity).
Basketball player makes 40% of free throws (p=0.4). Find P(X=3 failures before 3rd success).
$$P(X=3)=\binom{5}{3}(0.6)^3(0.4)^3=10\times0.216\times0.064\approx0.1382$$
Mean failures = 3(0.6)/0.4 = 4.5, so on average 4.5 misses before getting 3 makes.
"Negative Binomial counts negative things — it must involve negatives somehow."
The name comes from the negative binomial series expansion, not negative values. X counts the number of FAILURES before the r-th success, so X≥0 always. It generalizes the geometric distribution (r=1 failures before first success).
📖 Ross — Ch. 4.8
"Use Poisson for all count data."
Poisson requires Var=Mean. Real count data often shows overdispersion (Var>Mean) due to clustering or heterogeneity. The vs Poisson tab shows that NegBin has heavier tails for the same mean. Common examples: number of insurance claims (overdispersed), hospital admissions, words in a document, species counts in ecology.
📖 DeGroot & Schervish — Ch. 5.5
Confusing two NegBin parameterizations: k failures vs k trials
✅ Convention 1: X = number of failures before r-th success. Convention 2: X = total trials until r-th success (X≥r). Mean differs: r(1-p)/p vs r/p. Always check which convention your software uses.
🔍 R: rnbinom(n, size=r, prob=p) counts FAILURES. MATLAB uses total trials.