Contenido principal

gevlike

Generalized extreme value negative loglikelihood

Description

nlogL = gevlike(params,x) returns the generalized extreme value (GEV) negative loglikelihood of the distribution parameters (params) given the sample data (x). params(1) is the shape parameter k, params(2) is the scale parameter sigma, and params(3) is the location parameter mu.

example

[nlogL,aVar] = gevlike(params,x) also returns the inverse of the Fisher information matrix aVar. If the values in params are the maximum likelihood estimates (MLEs) of the parameters, the diagonal elements of aVar are their asymptotic variances. aVar is based on the observed Fisher information, not the expected information.

When k < 0, the GEV distribution is the type III extreme value distribution. When k > 0, the GEV distribution is the type II (Frechet) extreme value distribution. If w has a Weibull distribution, then –w has a type III extreme value distribution and 1/w has a type II extreme value distribution. In the limiting case as k approaches 0, the GEV distribution is the mirror image of the type I (Gumbel) extreme value distribution. For more information, see Generalized Extreme Value Distribution.

The mean of the GEV distribution is not finite when k1, and the variance is not finite when k1/2. The GEV distribution has positive density only for values of x such that k*(x – mu)/sigma > –1.

example

Examples

collapse all

Find the maximum likelihood estimates (MLEs) of a random data set drawn from the generalized extreme value distribution by using mle, and then find the negative loglikelihood of the MLEs by using gevlike.

Generate 1000 random numbers from the generalized extreme value distribution with the shape parameter k, scale parameter sigma, and location parameter mu.

rng(0,"twister") % For reproducibility
n = 1000; % Number of samples
x = gevrnd(0.5,2,2,[n,1]);

Find the MLEs for the distribution parameters (location and scale) by using mle.

pHat = mle(x,Distribution="Generalized Extreme Value")
pHat = 1×3

    0.4844    1.8462    1.9334

Compute the negative loglikelihood of the MLEs and the inverse of the Fisher information matrix by using gevlike.

[nlogL,aVar] = gevlike(pHat,x)
nlogL = 
2.4693e+03
aVar = 3×3

    0.0009    0.0003   -0.0005
    0.0003    0.0040    0.0030
   -0.0005    0.0030    0.0044

Because pHat contains MLE values, the gevlike function returns their asymptotic variances in the diagonal elements of aVar.

Input Arguments

collapse all

Generalized extreme value distribution parameters, specified as a vector of three numeric values. params(1) is the shape parameter k, params(2) is the scale parameter sigma, and params(3) is the location parameter mu. params(2) must be positive.

Data Types: single | double

Sample data, specified as a numeric vector.

Data Types: single | double

Output Arguments

collapse all

Negative loglikelihood value of the distribution parameters (params) given the sample data (x), returned as a numeric scalar.

Inverse of the Fisher information matrix, returned as a 3-by-3 numeric matrix. aVar is based on the observed Fisher information given the observed data (x), not the expected information.

If values in params are the MLEs of the parameters, aVar is an approximation to the asymptotic variance-covariance matrix (also known as the asymptotic covariance matrix). To find the MLEs, use mle.

Alternative Functionality

gevlike is a function specific to the generalized extreme value distribution. Statistics and Machine Learning Toolbox™ also offers the generic functions mlecov, fitdist, negloglik, and proflik and the Distribution Fitter app, which support various probability distributions.

  • mlecov returns the asymptotic covariance matrix of the MLEs of the parameters for a distribution specified by a custom probability density function. For example, mlecov(params,x,'pdf',@gevpdf) returns the asymptotic covariance matrix of the MLEs for the generalized extreme value distribution.

  • Create a GeneralizedExtremeValueDistribution probability distribution object by fitting the distribution to data using the fitdist function or the Distribution Fitter app. The object property ParameterCovariance stores the covariance matrix of the parameter estimates. To obtain the negative loglikelihood of the parameter estimates and the profile of the likelihood function, pass the object to negloglik and proflik, respectively.

References

[1] Embrechts, P., C. Klüppelberg, and T. Mikosch. Modelling Extremal Events for Insurance and Finance. New York: Springer, 1997.

[2] Kotz, S., and S. Nadarajah. Extreme Value Distributions: Theory and Applications. London: Imperial College Press, 2000.

Extended Capabilities

expand all

Version History

Introduced before R2006a