Reputation: 576
Let's say I have an event that has a probability of 0.02 of occurring each time a button is pushed. I want to calculate the probability that the event will occur the 8th time someone presses a button.
I can calculate this manually with 0.98^7 * 0.02 as 0.017 but if I use pgeom(q = 7, prob = 0.02)
in R I get 0.149237. How can this be? I'm sure I'm missing something but I can't figure it out!
Upvotes: 2
Views: 198
Reputation: 5254
Try
dgeom(7, 0.02)
# returns 0.01736251
The geometric formula p*(1-p)^x
descibes the density function dgeom
. pgeom
, however, does not compute the density but the lower-tail of the distribution.
Upvotes: 3