dist_lognormal {distributional}R Documentation

The log-normal distribution

Description

[Stable]

The log-normal distribution is a commonly used transformation of the Normal distribution. If XX follows a log-normal distribution, then lnX\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 YY be a Normal random variable with mean mu = μ\mu and standard deviation sigma = σ\sigma. The log-normal distribution X=exp(Y)X = exp(Y) is characterised by:

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

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

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

Probability density function (p.d.f):

f(x)=1x2πσ2e(lnxμ)2/2σ2 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)=Φ((lnxμ)/σ) F(x) = \Phi((\ln{x} - \mu)/\sigma)

Where PhiPhi 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)

[Package distributional version 0.4.0 Index]