Why are there two different versions of the mean and variance for negative binomial distributions

On a wiki proof site, I've seen these formulas used for the mean and variance:

$E[X] = \frac{rp}{1-p}$ and $Var[X] = \frac{rp}{(1-p)^2}$. Yet on the Penn State site, they have these two different formulas: $E[X] = \frac{r}{p}$ and $Var[X] = \frac{r(1-p)}{p^2}$.

-

Two issues are involved:

• Is the negative binomial the distribution of the waiting time until a specified number of "successes" or until a specified number of "failures"?
• Is it the number of trials needed to get the specified number of "successes" (or, as the case may be, of "failures") or is it the number of trials that do not result in that many successes, or failures, before that number of "successes" or "failures" happens?

So we have four possibilities:

• It's the number of trials needed to get $r$ successes. Then we have $$\mathbb E(X) = \frac rp, \quad \operatorname{var}(X) = \frac{rp}{(1-p)^2}.$$
• It's the number of failures before the $r$th success. Then we have $$\mathbb E(X) = r\frac{1-p}{p},\quad \operatorname{var}(X) = \frac{rp}{(1-p)^2}.$$
• It's the number of trials needed to get $r$ failures. Then we have $$\mathbb E(X) = \frac r{1-p}, \quad \operatorname{var}(X) = \frac{r(1-p)}{p^2}.$$
• It's the number of successes before the $r$th failure. Then we have $$\mathbb E(X) = \frac{rp}{1-p},\quad \operatorname{var}(X) = \frac{rp}{(1-p)^2}.$$

One advantage to viewing it as the number of successes before the $r$th failure or as the number of failures before the $r$th success is that then it is an infinitely divisible distribution, and it naturally extends to the case where $r$ is not an integer. In that case it is supported on the set $\{0,2,3,4,\dots\}$. In the other cases it is supported on the set $\{r,r+1,r+2,r+3,\dots\}$.

-
Very good description of the sad lack of consensus about what $X$ counts, even in the case of the geometric. Unfortunately, elementary probability books usually choose to count the number of trials. – André Nicolas Aug 18 '13 at 5:15
@AndréNicolas : Thank you. – Michael Hardy Aug 18 '13 at 18:50
+1 for a very nice answer. I would like to suggest an improvement. It is worth pointing out explicitly that the random variables in the first two bulleted items are related as $X_2 = X_1-r$ so that $$\mathbb E(X_1) = \frac rp, \quad \operatorname{var}(X) = \frac{rp}{(1-p)^2}$$ which naturally leads to $$\mathbb E(X_2)= \mathbb E(X_1)-r = \frac rp -r = r\frac{1-p}{p},\quad \operatorname{var}(X_2) = \operatorname{var}(X_1) = \frac{rp}{(1-p)^2}$$ and similarly for the next two bulleted items. – Dilip Sarwate Aug 20 '13 at 2:29

It's a matter of semantics about the meaning of "success" (typically $p$ in the context of a binomial distribution) and "failure" (typically $q=1-p$). If the meaning is reversed in the context of the negative binomial, you'll get the same result, once you interchange $p$ with $1-p$.

So, you saw the same thing (assuming you really saw $E[X] = \frac{r}{p}-1$).

-
No, I didn't see $\frac{r}{p}$ - 1. Here is the Penn State site: onlinecourses.science.psu.edu/stat414/node/80 – Mark Jizelle Aug 18 '13 at 4:31
Actually, there are four conventions; see my answer. – Michael Hardy Aug 18 '13 at 5:08