Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Lognormal mean and variance

`[M,V] = lognstat(mu,sigma)`

`[M,V] = lognstat(mu,sigma)`

returns the mean of and
variance of the lognormal distribution with parameters `mu`

and
`sigma`

. `mu`

and `sigma`

are the
mean and standard deviation, respectively, of the associated normal distribution.
`mu`

and `sigma`

can be vectors, matrices, or
multidimensional arrays that all have the same size, which is also the size of
`M`

and `V`

. A scalar input for
`mu`

or `sigma`

is expanded to a constant array
with the same dimensions as the other input. The parameters in
`sigma`

must be positive.

The normal and lognormal distributions are closely related.
If *X* is distributed lognormally with parameters *µ* and *σ*,
then log(*X*) is distributed normally with mean *µ* and
standard deviation *σ*.

The mean *m* and variance *v* of
a lognormal random variable are functions of *µ* and *σ* that
can be calculated with the `lognstat`

function.
They are:

$$\begin{array}{l}m=\mathrm{exp}\left(\mu +{\sigma}^{2}/2\right)\\ v=\mathrm{exp}\left(2\mu +{\sigma}^{2}\right)\left(\mathrm{exp}\left({\sigma}^{2}\right)-1\right)\end{array}$$

A lognormal distribution with mean *m* and
variance *v* has parameters

$$\begin{array}{l}\mu =\mathrm{log}\left({m}^{2}/\sqrt{v+{m}^{2}}\right)\\ \sigma =\sqrt{\mathrm{log}\left(v/{m}^{2}+1\right)}\end{array}$$

Generate one million lognormally distributed random numbers with mean 1 and variance 2:

m = 1; v = 2; mu = log((m^2)/sqrt(v+m^2)); sigma = sqrt(log(v/(m^2)+1)); [M,V]= lognstat(mu,sigma) M = 1 V = 2.0000 X = lognrnd(mu,sigma,1,1e6); MX = mean(X) MX = 0.9974 VX = var(X) VX = 1.9776

[1] Mood, A. M., F. A. Graybill, and D. C. Boes. Introduction to the Theory of Statistics. 3rd ed., New York: McGraw-Hill, 1974. pp. 540–541.

Was this topic helpful?