Why
pgeom(20,0.01,lower.tail = FALSE)
1-sum(dgeom(1:20,0.01))
produce different results in R? The result should be the same (at least in theory), right?
Output:
[1] 0.8097279
[1] 0.8197279
I think you just forgot to account for 0. We can have zero of failures in a sequence of Bernoulli trials before a success occurs.
> (1-sum(dgeom(0:20,0.01))) == pgeom(20,0.01,lower.tail = FALSE)
# [1] TRUE