<< distfun_lognrnd LogNormal LogUniform >>

distfun >> distfun > LogNormal > distfun_lognstat

distfun_lognstat

LogNormal mean and variance

Calling Sequence

M = distfun_lognstat ( mu , sigma )
[M,V] = distfun_lognstat ( mu , sigma )

Parameters

mu :

a matrix of doubles, the mean of the underlying normal variable.

sigma :

a matrix of doubles, the standard deviation of the underlying normal variable. sigma>0.

M :

a matrix of doubles, the mean

V :

a matrix of doubles, the variance

Description

Computes statistics from the LogNormal distribution.

The mean and variance of the lognormal distribution are

\begin{eqnarray}
M &=& \exp\left(\mu+\sigma^2/2\right) \\
V &=& \left(\exp\left(\sigma^2\right)-1\right) \exp\left(2\mu+\sigma^2\right)
\end{eqnarray}

A lognormal distribution with mean m and variance v has parameters

mu = log(M) - 0.5 * log(1+V./(M.^2))
sigma = sqrt(log(1+V./(M.^2)))

Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.

Examples

mu = 1:6;
sigma = (1:6)^-1;
[M,V] = distfun_lognstat ( mu , sigma )
// See if we can recover the original parameters:
mu = log(M) - 0.5 * log(1+V./(M.^2))
sigma = sqrt(log(1+V./(M.^2)))

Authors


Report an issue
<< distfun_lognrnd LogNormal LogUniform >>