Lognormal {base} | R Documentation |
The Log Normal Distribution
Description
Density, distribution function, quantile function and random
generation for the log normal distribution whose logarithm has mean
equal to meanlog
and standard deviation equal to sdlog
.
Usage
dlnorm(x, meanlog = 0, sdlog = 1, log = FALSE)
plnorm(q, meanlog = 0, sdlog = 1, lower.tail = TRUE, log.p = FALSE)
qlnorm(p, meanlog = 0, sdlog = 1, lower.tail = TRUE, log.p = FALSE)
rlnorm(n, meanlog = 0, sdlog = 1)
Arguments
x , q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations to generate. |
meanlog , sdlog |
mean and standard deviation of the distribution on the log scale. |
log , log.p |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are
|
Details
If meanlog
or sdlog
are not specified they assume the
default values of 0
and 1
respectively.
The log normal distribution has density
f(x) = \frac{1}{\sqrt{2\pi}\sigma x} e^{-(\log(x) - \mu)^2/2 \sigma^2}%
where \mu
and \sigma
are the mean and standard
deviation of the logarithm.
Value
dlnorm
gives the density,
plnorm
gives the distribution function,
qlnorm
gives the quantile function, and
rlnorm
generates random deviates.
Note
The cumulative hazard H(t) = - \log(1 - F(t))
is -plnorm(t, r, lower = FALSE, log = TRUE)
.
See Also
dnorm
for the normal distribution.
Examples
dlnorm(1) == dnorm(0)
x <- rlnorm(1000) # not yet always :
all(abs(x - qlnorm(plnorm(x))) < 1e4 * .Machine$double.eps * x)