Negative binomial distribution
= Negative binomial distribution
{wiki}
On the failures-before-the-$r$th-success convention, a negative binomial variable with success probability $p$ has probability mass function
$$
\mathbb P(X=x)=\binom{x+r-1}{x}(1-p)^x p^r,
\qquad x=0,1,\ldots.
$$
It has expected value $r(1-p)/p$ and variance $r(1-p)/p^2$.