This question was given in class and I was wondering how to do this in R:
"Sixty percent of a large lot of old spark plugs are still usable, and they can be individually tested to determine this. Let Y be the number plugs to be tested in order to find 5 usable items."
Find the probability P[Y<=10]
I wish to apply the Negative Binomial distribution. I know the answer to be 0.834. This is the R code that I was working on. This returns the wrong answer.
sum(dnbinom(x=0:10,size=10,prob=0.6))
[1] 0.8724788
This set of parameters seem to return the correct answer, but I don't know why it is correct.
sum(dnbinom(x=0:5,size=5,prob=0.6))
[1] 0.8337614
dnbinom(x=0:10,size=10,prob=0.6)
does -- and how does "5 useable items" come into that calculation? Why sum results fromdnbinom
rather than simply callingpnbinom
? $\endgroup$