\Header{Lognormal}{The Log Normal Distribution}
\alias{dlnorm}{Lognormal}
\alias{plnorm}{Lognormal}
\alias{qlnorm}{Lognormal}
\alias{rlnorm}{Lognormal}
\keyword{distribution}{Lognormal}
\begin{Description}\relax
Density, distribution function, quantile function and random
generation for the log normal distribution whose logarithm has mean
equal to \code{meanlog} and standard  deviation equal to \code{sdlog}.\end{Description}
\begin{Usage}
\begin{verbatim}
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)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x, q}] vector of quantiles.
\item[\code{p}] vector of probabilities.
\item[\code{n}] number of observations. If \code{length(n) > 1}, the length
is taken to be the number required.
\item[\code{meanlog, sdlog}] mean and standard deviation of the distribution
on the log scale with default values of \code{0} and \code{1} respectively.
\item[\code{log, log.p}] logical; if TRUE, probabilities p are given as log(p).
\item[\code{lower.tail}] logical; if TRUE (default), probabilities are
\eqn{P[X \le x]}{P[X <= x]}, otherwise, \eqn{P[X > x]}{P[X > x]}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The log normal distribution has density
\deqn{
f(x) = \frac{1}{\sqrt{2\pi}\sigma x} e^{-(\log(x) - \mu)^2/2 \sigma^2}
}{f(x) = 1/(sqrt(2 pi) sigma x) e^-((log x - mu)^2 / (2 sigma^2))}
where \eqn{\mu}{} and \eqn{\sigma}{} are the mean and standard
deviation of the logarithm.
The mean is \eqn{E(X) = exp(\mu + 1/2 \sigma^2)}{}, and the variance
\eqn{Var(X) = exp(2\mu + \sigma^2)(exp(\sigma^2) - 1)}{Var(X) = exp(2*mu + sigma^2)*(exp(sigma^2) - 1)} and
hence the coefficient of variation is
\eqn{\sqrt{exp(\sigma^2) - 1}}{sqrt(exp(sigma^2) - 1)} which is
approximately \eqn{\sigma}{} when that is small (e.g. \eqn{\sigma < 1/2}{}).\end{Details}
\begin{Value}
\code{dlnorm} gives the density,
\code{plnorm} gives the distribution function,
\code{qlnorm} gives the quantile function, and
\code{rlnorm} generates random deviates.\end{Value}
\begin{Note}\relax
The cumulative hazard \eqn{H(t) = - \log(1 - F(t))}{H(t) = - log(1 - F(t))}
is \code{-plnorm(t, r, lower = FALSE, log = TRUE)}.\end{Note}
\begin{SeeAlso}\relax
\code{\Link{dnorm}} for the normal distribution.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
dlnorm(1) == dnorm(0)
x <- rlnorm(1000)       # not yet always :
all(abs(x  -  qlnorm(plnorm(x))) < 1e4 * .Machine$double.eps * x)
\end{ExampleCode}
\end{Examples}

