Log-Normal distribution


Story

If \(\ln y\) is Normally distributed, then \(y\) is Log-Normally distributed.


Example

A measure of fold change in gene expression can be Log-Normally distributed.


Parameters

As for the Normal distribution, there are two parameters, the location parameter \(\mu\) and the scale parameter \(\sigma\). Note that \(\mu\) is the mean of \(\ln y\), not of \(y\) itself. That is, \(\langle\ln y\rangle_{\mathrm{LogNorm}} = \mu\). Similarly, \(\langle(\ln y - \mu)^2\rangle_{\mathrm{LogNorm}} = \sigma^2\).


Support

The Log-Normal distribution is supported on the set of positive real numbers.


Probability density function

\[\begin{align} f(y;\mu, \sigma) = \frac{1}{y\sqrt{2\pi\sigma^2}}\,\mathrm{e}^{-(\ln y-\mu)^2/2\sigma^2}. \end{align}\]

Cumulative distribution function

\[\begin{align} F(y;\mu, \sigma) =\frac{1}{2}\left(1 + \text{erf}\left(\frac{\ln y - \mu}{\sigma\sqrt{2}}\right)\right), \end{align}\]

where \(\text{erf}(x)\) denotes the error function.


Moments

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

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


Usage

Package

Syntax

NumPy

rng.lognormal(mu, sigma)

SciPy

scipy.stats.lognorm(sigma, loc=0, scale=np.exp(mu))

Distributions.jl

LogNormal(mu, sigma)

Stan

lognormal(mu, sigma)



Notes

  • Be careful not to get confused. The Log-Normal distribution describes the distribution of \(y\) given that \(\ln y\) is Normally distributed. It does not describe the distribution of \(\ln y\).

  • The way location, scale, and shape parameters work in SciPy for the Log-Normal distribution is confusing. If you want to specify a Log-Normal distribution as we have defined it using scipy.stats, use a shape parameter equal to \(\sigma\), a location parameter of zero, and a scale parameter given by \(\mathrm{e}^\mu\). For example, to compute the PDF, you would use scipy.stats.lognorm.pdf(y, sigma, loc=0, scale=np.exp(mu)).


PDF and CDF plots