Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

LogNormal

Create a LogNormal distribution


Description

A random variable created by exponentiating a Normal() distribution. Taking the log of LogNormal data returns in Normal() data.

Usage

LogNormal(log_mu = 0, log_sigma = 1)

Arguments

log_mu

The location parameter, written μ in textbooks. Can be any real number. Defaults to 0.

log_sigma

The scale parameter, written σ in textbooks. Can be any positive real number. Defaults to 1.

Details

We recommend reading this documentation on https://alexpghayes.github.io/distributions3, where the math will render with additional detail and much greater clarity.

In the following, let X be a LogNormal random variable with success probability p = p.

Support: R^+

Mean: \exp(μ + σ^2/2)

Variance: [\exp(σ^2)-1]\exp(2μ+σ^2)

Probability density function (p.d.f):

f(x) = \frac{1}{xσ√{2π}}\exp(-\frac{(\log x - μ)^2}{2σ^2})

Cumulative distribution function (c.d.f):

F(x) = \frac{1}{2} + \frac{1}{2√{pi}}\int_{-x}^x e^{-t^2} dt

Moment generating function (m.g.f): Undefined.

Value

A LogNormal object.

See Also

Examples

set.seed(27)

X <- LogNormal(0.3, 2)
X

random(X, 10)

pdf(X, 2)
log_pdf(X, 2)

cdf(X, 4)
quantile(X, 0.7)

distributions3

Probability Distributions as S3 Objects

v0.1.1
MIT + file LICENSE
Authors
Alex Hayes [aut, cre] (<https://orcid.org/0000-0002-4985-5160>), Ralph Moller-Trane [aut], Emil Hvitfeldt [ctb] (<https://orcid.org/0000-0002-0679-1945>), Daniel Jordan [ctb], Bruna Wundervald [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.