How is this Negative Binomial Random variable used to solve this problem? I was looking at the solution to this problem below and I don't understand how they used a negative binomial R.V. to solve the problem.

A research study is concerned with the side effects of a new drug. The drug is given to patients, one at a time, until two patients develop side effects. If the probability of  getting a side effect from the drug is (1/6), what is the probability that eight patients are needed?

The answer that is given to the question is below.

Let Y be the number of patients who do not show side effects. Then Y follows a negative binomial distribution with r=2,y=6 and p=(1/6).
  Thus

P[Y=6]=( (2+6)-1 nCr 6 )(1/6)^2 (5/6)^6 = .0651

Now this is where I'm getting confused. I have my notes on the negative binomial R.V. below:

Suppose that independent trials, each having probability, 0

P[X=n]=( (n-1)nCr(r-1) )(p)^r (1-p)^n-r



*

*Why does it seem like 6 is used for r in one part of the answer but 2 is used for r in another part of the answer?

*If the value for Y that is used in the answer is supposed to be the same as the value for n in my notes why do they add 2 to n?

*Why is the value for n-r equal to 6 instead of 4 (6-2)?


Any clarifying explanations would be really appreciated.
 A: Your confusion stems from the way the random variable $Y$ is defined:  it does not match the way the probability mass function for $X$ is defined.
$Y$ counts the number of patients who do not show side effects, not the total number of patients observed.  $X$, on the other hand, counts the total number of trials needed to observe $r$ events of interest, where $p$ is the probability of observing an event of interest for a single trial.
The relationship between $Y$ and $X$ is $X = Y + r$:  the total number of trials equals the sum of the non-events $Y$ plus the number of events $r$.  $Y$ is random; $r$ is a fixed constant (in your case, $r = 2$).  Note that $8 = 6 + 2$.
Really, the solution could have been written more clearly by avoiding the use of $Y$ and appealing directly to $X$.  We then have $$\Pr[X = 8] = \binom{8-1}{2-1} (1/6)^2 (1 - 1/6)^{8-2},$$ which is the desired probability.  In terms of $Y$, the PMF is $$\Pr[Y = y] = \binom{r+y-1}{y} p^r (1-p)^y, \quad y = 0, 1, 2, \ldots.$$  Note that this is a different parametrization of the negative binomial distribution; the support of $Y$ is $0, 1, 2, 3, \ldots,$ whereas for $X$, the support is $r, r+1, r+2, r+3, \ldots$.  Either one works, but you need to be careful not to mix up the two.  Again, $Y$ counts the number of "non-interesting" events, whereas $X$ counts the total trials (including the events of interest) needed to observe $r$ events of interest.
