dist_lognormal: The log-normal distribution

View source: R/dist_lognormal.R

dist_lognormalR Documentation

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 characteristed 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 https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.

In the following, let Y be a Normal random variable with mean mu = \mu and standard deviation sigma = \sigma. The log-normal distribution X = exp(Y) is characterised by:

Support: R+, the set of all real numbers greater than or equal to 0.

Mean: e^(\mu + \sigma^2/2

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

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):

The cumulative distribution function has the form

F(x) = \Phi((\ln{x} - \mu)/\sigma)

Where Phi is the CDF of a standard Normal distribution, N(0,1).

See Also

stats::Lognormal

Examples

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)

distributional documentation built on March 31, 2023, 7:12 p.m.