This help topic is for R version 0.64.2. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/Geometric.html
Geometric {base}R Documentation

The Geometric Distribution

Description

These functions provide information about the geometric distribution with parameter prob. dgeom gives the density, pgeom gives the distribution function, qgeom gives the quantile function, and rgeom generates random deviates.

Usage

dgeom(x, prob)
pgeom(q, prob)
qgeom(p, prob)
rgeom(n, prob)

Arguments

x, q

vector of quantiles representing the number of failures in a sequence of Bernoulli trials before success occurs.

p

vector of probabilities.

n

number of observations to generate.

prob

probability of success in each trial.

Details

The geometric distribution with prob = p has density

p(x) = p {(1-p)}^{x}

for x = 0, 1, 2, \ldots

If an element of x is not integer, the result of pgeom is zero, with a warning.

See Also

dnbinom for the negative binomial which generalizes the geometric distribution.

Examples

pp <- sort(c((1:9)/10, 1 - .2^(2:8)))
print(qg <- qgeom(pp, prob = .2))
for(i in 1:2) print(qg <- qgeom(pgeom(qg, prob=.2), prob =.2))
Ni <- rgeom(20, prob = 1/4); table(factor(Ni, 0:max(Ni)))

[Package base version 0.64.2 ]