# Negative Binomial Distribution

Posted by Beetle B. on Thu 18 May 2017

The experiment requires:

1. The trials be independent
2. The outcome is binary (success or failure).
3. The probability of success or failure is independent from trial to trial.
4. The trials continue until you have $$r$$ successes.

The random variable $$X$$ counts the number of failures prior to having $$r$$ successes.

\begin{equation*} nb(x;r,p)=\dbinom{x+r-1}{r-1}p^{r}(1-p)^{x} \end{equation*}

When $$r=1$$, this is the geometric distribution.

\begin{equation*} E(X)=\frac{r(1-p)}{p} \end{equation*}
\begin{equation*} V(x)=\frac{r(1-p)}{p^{2}} \end{equation*}

## Properties

There is a generalized negative binomial distribution where the $$r$$ is not an integer.

Often used as an alternative to the Poisson distribution when it’s clear that the mean and variance don’t match. As this distribution has one extra parameter, we can tweak it to match the variance.

## Example

(Taken from Bruce Hajek’s lecture notes).

### Problem

Suppose a fair die is repeatedly rolled until each of the numbers one through six shows at least once. What is the mean number of rolls?

### Solution

Let $$R=R_{1}+\cdots+R_{6}$$ where $$R_{i}$$ is the number of rolls made after $$i-1$$ distinct numbers have shown up, up to and including the roll such that $$i$$ shows up.

Think of the sequence of numbers and insert a vertical bar after each new number shows up.

\begin{equation*} p_{i}=\frac{6-i+1}{6} \end{equation*}

$$R{i}$$ is a random variable that follows a geometric distribution with $$r=1$$.

And $$\mu=\sum_{i}\mu_{i}$$