Gompertz.Rd
Density, distribution function, quantile function and random generation for the Gompertz distribution with unrestricted shape.
dGompertz(x, shape, rate = 1, log = FALSE)
pGompertz(q, shape, rate = 1, lower.tail = TRUE, log.p = FALSE)
qGompertz(p, shape, rate = 1, lower.tail = TRUE, log.p = FALSE)
rGompertz(n, shape = 1, rate = 1)
vector of quantiles.
vector of shape and rate parameters.
logical; if TRUE, probabilities p are given as log(p).
logical; if TRUE (default), probabilities are \(P(X \le x)\), otherwise, \(P(X > x)\).
vector of probabilities.
number of observations. If length(n) > 1
, the length is
taken to be the number required.
dGompertz
gives the density, pGompertz
gives the
distribution function, qGompertz
gives the quantile function,
and rGompertz
generates random deviates.
The Gompertz distribution with shape
parameter \(a\) and
rate
parameter \(b\) has probability density function
$$f(x | a, b) = be^{ax}\exp(-b/a (e^{ax} - 1))$$
For \(a=0\) the Gompertz is equivalent to the exponential distribution with constant hazard and rate \(b\).
The probability distribution function is $$F(x | a, b) = 1 - \exp(-b/a (e^{ax} - 1))$$
Thus if \(a\) is negative, letting \(x\) tend to infinity shows that
there is a non-zero probability \(1 - \exp(b/a)\) of living
forever. On these occasions qGompertz
and rGompertz
will
return Inf
.
Some implementations of the Gompertz restrict \(a\) to be strictly
positive, which ensures that the probability of survival decreases to zero
as \(x\) increases to infinity. The more flexible implementation given
here is consistent with streg
in Stata.
The functions dGompertz
and similar available in the
package eha label the parameters the other way round, so that what is
called the shape
there is called the rate
here, and what is
called 1 / scale
there is called the shape
here. The
terminology here is consistent with the exponential dexp
and
Weibull dweibull
distributions in R.
Stata Press (2007) Stata release 10 manual: Survival analysis and epidemiological tables.