## The Negative Binomial Distribution

The negative binomial models the number of trials
$n$
up to and including a given number of successes
$x$
, where the probability of success is a fixed
$p$
. The first
$x-1$
successes may be any of the first
$n-1$
trials, but the
$n$
th trial must be the
$x$
th success.
We may model the first
$x-1$
successes from
$n-1$
by the binomial
$B(n-1,p)$
distribution:
\begin{aligned}P(X=x-1) &={}^{n-1}C_{x-1}p^{x-1}(1-p)^{(n-1)-(x-1)} \\ &={}^{n-1}C_{x-1}p^{x-1}(1-p)^{n-x}{}\end{aligned}

The
$n$
th trial is the
$x$
th success with probability
$p$
, so the probability of the needing
$n$
trials to obtain
$x$
successes is
${}^{n-1}C_{x-1}p^x(1-p)^{n-x}$
.
It is important to realise that the variable being modelled here is
$n$
.
$x$
is the fixed number of successes.
It is often convenient to reparametrize in terms of number of successes and failures, so let
$k$
be number of failures, then
$x+k=n$
and the expression becomes
${}^{x+k-1}C_{x-1}p^x(1-p)^{k}$
.

Refresh