Discrete distribution · also called Pascal

Negative binomial distribution

The number of failures before the -th success in independent trials: missed sales calls before the third sale. Allowing to be any positive real number turns it into the standard model for counts that vary more than a Poisson would allow (its variance always exceeds its mean), such as the number of reads of a gene or of claims per policyholder.

Negative binomial probability calculator

P(X ≤ 4) = 0.580096

At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends. For a discrete distribution, < and ≤ differ.

PMF

00.050.105101520P(X = k)mean

CDF

00.250.50.75105101520F(x)

mean 4.5 · variance 11.25 · sd 3.354 · mode 2

Formulas

Parameters
  • , the number of successes to wait for
  • , the probability of success on each trial
Support
PMF
CDF
Mean
Variance
Mode
MGF

Conventions differ: some books count trials rather than failures, or swap the roles of and . This page, SciPy's nbinom and NumPy all count failures with success probability .

Worked example

A salesperson closes 20% of calls. What is the probability she makes exactly 5 unsuccessful calls before her third sale?

With and : answer checked by code

How it relates to others

All the relationships, as a diagram →

In Python

from scipy import stats
import numpy as np

X = stats.nbinom(n=3, p=0.4)
X.pmf(2)  # P(X = 2) = 0.1382
X.cdf(2)  # P(X ≤ 2) = 0.3174
X.mean(), X.var()  # 4.5, 11.25
X.ppf(0.95)  # 95th percentile
X.rvs(size=10, random_state=0)

rng = np.random.default_rng(0)
rng.negative_binomial(n=3, p=0.4, size=10)

SciPy and NumPy call r "n".

Choosing between this and its neighbours? Which distribution for count data? · Which distribution for waiting times and lifetimes? · Which prior distribution should I use?

← GeometricPoisson →