简体   繁体   中英

Is R's pgeom function incorrect?

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM