Learn R Programming

distributional (version 0.6.0)

dist_lognormal: The log-normal distribution

Description

[Stable]

The log-normal distribution is a commonly used transformation of the Normal distribution. If \(X\) follows a log-normal distribution, then \(\ln{X}\) would be characterised by a Normal distribution.

Usage

dist_lognormal(mu = 0, sigma = 1)

Arguments

mu

The mean (location parameter) of the distribution, which is the mean of the associated Normal distribution. Can be any real number.

sigma

The standard deviation (scale parameter) of the distribution. Can be any positive number.

Details

We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_lognormal.html

In the following, let \(X\) be a log-normal random variable with mu = \(\mu\) and sigma = \(\sigma\).

Support: \(R^+\), the set of positive real numbers.

Mean: \(e^{\mu + \sigma^2/2}\)

Variance: \((e^{\sigma^2} - 1) e^{2\mu + \sigma^2}\)

Skewness: \((e^{\sigma^2} + 2) \sqrt{e^{\sigma^2} - 1}\)

Excess Kurtosis: \(e^{4\sigma^2} + 2 e^{3\sigma^2} + 3 e^{2\sigma^2} - 6\)

Probability density function (p.d.f):

$$ f(x) = \frac{1}{x\sqrt{2 \pi \sigma^2}} e^{-(\ln{x} - \mu)^2 / (2 \sigma^2)} $$

Cumulative distribution function (c.d.f):

$$ F(x) = \Phi\left(\frac{\ln{x} - \mu}{\sigma}\right) $$

where \(\Phi\) is the c.d.f. of the standard Normal distribution.

Moment generating function (m.g.f):

Does not exist in closed form.

See Also

Examples

Run this code
dist <- dist_lognormal(mu = 1:5, sigma = 0.1)

dist
mean(dist)
variance(dist)
skewness(dist)
kurtosis(dist)

generate(dist, 10)

density(dist, 2)
density(dist, 2, log = TRUE)

cdf(dist, 4)

quantile(dist, 0.7)

# A log-normal distribution X is exp(Y), where Y is a Normal distribution of
# the same parameters. So log(X) will produce the Normal distribution Y.
log(dist)

Run the code above in your browser using DataLab