Contents

lognfit

Lognormal parameter estimates

Syntax

parmhat = lognfit(data)
[parmhat,parmci] = lognfit(data)
[parmhat,parmci] = lognfit(data,alpha)
[...] = lognfit(data,alpha,censoring)
[...] = lognfit(data,alpha,censoring,freq)
[...] = lognfit(data,alpha,censoring,freq,options)

Description

parmhat = lognfit(data) returns a vector of maximum likelihood estimates parmhat(1) = mu and parmhat(2) = sigma of parameters for a lognormal distribution fitting data. mu and sigma are the mean and standard deviation, respectively, of the associated normal distribution.

[parmhat,parmci] = lognfit(data) returns 95% confidence intervals for the parameter estimates mu and sigma in the 2-by-2 matrix parmci. The first column of the matrix contains the lower and upper confidence bounds for parameter mu, and the second column contains the confidence bounds for parameter sigma.

[parmhat,parmci] = lognfit(data,alpha) returns 100(1 -  alpha) % confidence intervals for the parameter estimates, where alpha is a value in the range (0 1) specifying the width of the confidence intervals. By default, alpha is 0.05, which corresponds to 95% confidence intervals.

[...] = lognfit(data,alpha,censoring) accepts a Boolean vector censoring, of the same size as data, which is 1 for observations that are right-censored and 0 for observations that are observed exactly.

[...] = lognfit(data,alpha,censoring,freq) accepts a frequency vector, freq, of the same size as data. Typically, freq contains integer frequencies for the corresponding elements in data, but can contain any nonnegative values. Pass in [] for alpha, censoring, or freq to use their default values.

[...] = lognfit(data,alpha,censoring,freq,options) accepts a structure, options, that specifies control parameters for the iterative algorithm the function uses to compute maximum likelihood estimates when there is censoring. The lognormal fit function accepts an options structure which can be created using the function statset. Enter statset('lognfit') to see the names and default values of the parameters that lognfit accepts in the options structure. See the reference page for statset for more information about these options.

    Note:   With no censoring, lognfit computes sigma using the square root of the unbiased estimator of the variance. With censoring, sigma is the maximum likelihood estimate.

Examples

This example generates 100 independent samples of lognormally distributed data with µ = 0 and σ = 3. parmhat estimates µ and σ and parmci gives 99% confidence intervals around parmhat. Notice that parmci contains the true values of µ and σ.

data = lognrnd(0,3,100,1);
[parmhat,parmci] = lognfit(data,0.01)
parmhat =
  -0.2480  2.8902
parmci =
  -1.0071  2.4393
   0.5111  3.5262
Was this topic helpful?