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 shown for k from r to an upper limit (≈ mean+5σ). Probabilities for large k are very small.
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:
This calculator uses the trials form (Pascal). The distribution is widely used for overdispersed count data where variance exceeds the mean.
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.
Verified against R's dnbinom (trials form).
All calculations use exact combinatorial arithmetic via math.comb.