There is an example question in the book Head First Statistics:
20% of cereal packets contain a free toy. What’s the probability you’ll need to open fewer than 4 cereal packets before finding your first toy?
The worked solution is given as:
P(X ≤ 3)
= 1 - q^r
= 1 - 0.8^3
= 1 - 0.512
= 0.488
I would have expected to use the following R statement:
> pgeom(3, 0.2)
[1] 0.5904
But as you can see the answer isn't as expected. The correct value for the n parameter is 2 as can be seen below:
> pgeom(2, 0.2)
[1] 0.488
Can someone explain why this is the case and where I am thinking about this incorrectly?
I just ran into this. My text book and pgeom use different density functions. From the documentation, pgeom uses p(x) = p*(1-p)^x, my book uses p(x) = p*(1-p)^(x-1). Presumably Head First uses the latter formula too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With