Main Content

lognstat

Lognormal mean and variance

Description

[m,v] = lognstat(mu,sigma) returns the mean and variance of the lognormal distribution with the distribution parameters mu (mean of logarithmic values) and sigma (standard deviation of logarithmic values).

example

Examples

collapse all

Compute the mean and variance of the lognormal distribution with parameters mu and sigma.

mu = 0;
sigma = 1;
[m,v] = lognstat(mu,sigma)
m = 
1.6487
v = 
4.6708

Input Arguments

collapse all

Mean of logarithmic values for the lognormal distribution, specified as a scalar value or an array of scalar values.

To compute the means and variances of multiple distributions, specify distribution parameters using an array of scalar values. If both mu and sigma are arrays, then the array sizes must be the same. If either mu or sigma is a scalar, then lognstat expands the scalar argument into a constant array of the same size as the other argument. Each element in m and v is the mean and variance of the distribution specified by the corresponding elements in mu and sigma.

Example: [0 1 2; 0 1 2]

Data Types: single | double

Standard deviation of logarithmic values for the lognormal distribution, specified as a positive scalar value or an array of positive scalar values.

To compute the means and variances of multiple distributions, specify distribution parameters using an array of scalar values. If both mu and sigma are arrays, then the array sizes must be the same. If either mu or sigma is a scalar, then lognstat expands the scalar argument into a constant array of the same size as the other argument. Each element in m and v is the mean and variance of the distribution specified by the corresponding elements in mu and sigma.

Example: [1 1 1; 2 2 2]

Data Types: single | double

Output Arguments

collapse all

Mean of the lognormal distribution, returned as a scalar value or an array of scalar values. m is the same size as mu and sigma after any necessary scalar expansion. Each element in m is the mean of the lognormal distribution specified by the corresponding elements in mu and sigma.

Variance of the lognormal distribution, returned as a scalar value or an array of scalar values. v is the same size as mu and sigma after any necessary scalar expansion. Each element in v is the variance of the lognormal distribution specified by the corresponding elements in mu and sigma.

More About

collapse all

Lognormal Distribution

The lognormal distribution is a probability distribution whose logarithm has a normal distribution.

The mean m and variance v of a lognormal random variable are functions of the lognormal distribution parameters µ and σ:

m=exp(μ+σ2/2)v=exp(2μ+σ2)(exp(σ2)1)

Also, you can compute the lognormal distribution parameters µ and σ from the mean m and variance v:

μ=log(m2/v+m2)σ=log(v/m2+1)

Alternative Functionality

  • lognstat is a function specific to lognormal distribution. Statistics and Machine Learning Toolbox™ also offers generic functions to compute summary statistics, including mean (mean), median (median), interquartile range (iqr), variance (var), and standard deviation (std). These generic functions support various probability distributions. To use these functions, create a LognormalDistribution probability distribution object and pass the object as an input argument.

References

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

[2] Evans, M., N. Hastings, and B. Peacock. Statistical Distributions. 2nd ed., Hoboken, NJ: John Wiley & Sons, Inc., 1993.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a