prob
.dgeom(x, prob, log = FALSE)
pgeom(q, prob, lower.tail = TRUE, log.p = FALSE)
qgeom(p, prob, lower.tail = TRUE, log.p = FALSE)
rgeom(n, prob)
length(n) > 1
, the length
is taken to be the number required.0 < prob <= 1
.dgeom
gives the density,
pgeom
gives the distribution function,
qgeom
gives the quantile function, and
rgeom
generates random deviates. Invalid prob
will result in return value NaN
, with a warning. The length of the result is determined by n
for
rgeom
, and is the maximum of the lengths of the
numerical arguments for the other functions. The numerical arguments other than n
are recycled to the
length of the result. Only the first elements of the logical
arguments are used.prob
\(= p\) has density
$$p(x) = p {(1-p)}^{x}$$
for \(x = 0, 1, 2, \ldots\), \(0 < p \le 1\). If an element of x
is not integer, the result of dgeom
is zero, with a warning. The quantile is defined as the smallest value \(x\) such that
\(F(x) \ge p\), where \(F\) is the distribution function.dnbinom
for the negative binomial which generalizes
the geometric distribution.qgeom((1:9)/10, prob = .2)
Ni <- rgeom(20, prob = 1/4); table(factor(Ni, 0:max(Ni)))
Run the code above in your browser using DataLab