Lognormal probability density function

`Y = lognpdf(X,mu,sigma)`

`Y = lognpdf(X,mu,sigma)`

returns
values at `X`

of the lognormal pdf with distribution
parameters `mu`

and `sigma`

. `mu`

and `sigma`

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

, `mu`

, and `sigma`

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

. A scalar
input for `X`

, `mu`

, or `sigma`

is
expanded to a constant array with the same dimensions as the other
inputs.

The lognormal pdf is

$$y=f(x|\mu ,\sigma )=\frac{1}{x\sigma \sqrt{2\pi}}{e}^{\frac{-{\left(\mathrm{ln}x-\mu \right)}^{2}}{2{\sigma}^{2}}}$$

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}$$

So, 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}$$

If you do not know the population mean and variance, *m* and *v*,
for the lognormal distribution, you can estimate $$\mu $$ and $$\sigma $$ in the following way:

mu = mean(log(X)) sigma = std(log(X))

The lognormal distribution is applicable when the quantity of
interest must be positive, since log(*X*) exists
only when *X* is positive.

[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?