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
Cumulative distribution function
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 |
|
SciPy |
|
Distributions.jl |
|
Stan |
|
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 usescipy.stats.lognorm.pdf(y, sigma, loc=0, scale=np.exp(mu))
.