confused about the mean of negative binomial distribution Let X be a random variable of the negative binomial distribution with parameters $r$ and $p$, 
$$P(X = n)~=~{n-1\choose r-1} p^r(1-p)^{n-r} .$$
The textbook says the mean is ${r(1-p)\over p}$, which confuses me because I always  consider the negative binomial distribution random variable $X$ as the sum of $r$ independent  geometric distributed random variable $\tau$, 
$$P(\tau = n)~=~p(1-p)^{n-1}.$$
Then by linearity of expectation, we get the mean of $X$ should be ${r\over p}$,since the mean of $\tau$ is ${1\over p}$. Can anyone helps me figure it out?

There are two different conventions for the geometric distribution. One counts the number of trials, has support $\{ 1,2,\dots \}$, and has mean $1/p$. The other counts the number of failures, has support $\{ 0,1,\dots \}$, and has mean $(1-p)/p$. 
Summing iid copies of these gives two different kinds of negative binomial distributions. There is also a variant of the negative binomial distribution which counts successes rather than failures, so that $p$ and $1-p$ get switched around. You simply have to be aware of the convention being used in a given context.
