Density, distribution function, quantile function and random
generation for the geometric distribution with parameter
1 2 3 4
vector of quantiles representing the number of failures in a sequence of Bernoulli trials before success occurs.
vector of probabilities.
number of observations. If
probability of success in each trial.
logical; if TRUE, probabilities p are given as log(p).
logical; if TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x].
The geometric distribution with
prob = p has density
p(x) = p (1-p)^x
for x = 0, 1, 2, …, 0 < p ≤ 1.
If an element of
x is not integer, the result of
is zero, with a warning.
The quantile is defined as the smallest value x such that F(x) ≥ p, where F is the distribution function.
dgeom gives the density,
pgeom gives the distribution function,
qgeom gives the quantile function, and
rgeom generates random deviates.
prob will result in return value
NaN, with a warning.
The length of the result is determined by
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.
dgeom computes via
dbinom, using code contributed by
Catherine Loader (see
qgeom are based on the closed-form formulae.
rgeom uses the derivation as an exponential mixture of Poissons, see
Devroye, L. (1986) Non-Uniform Random Variate Generation. Springer-Verlag, New York. Page 480.
Distributions for other standard distributions, including
dnbinom for the negative binomial which generalizes
the geometric distribution.