Contenuto principale

evlike

Extreme value negative loglikelihood

Description

nlogL = evlike(params,x) returns the type 1 extreme value negative loglikelihood of the distribution parameters (params) given the sample data (x). params(1) and params(2) are the location parameter mu and scale parameter sigma, respectively.

The type 1 extreme value distribution is also known as the Gumbel distribution. The software uses a version of the distribution that is suitable for modeling minima. You can use the mirror image of this distribution to model maxima by negating x. If x has a Weibull distribution, then X = log(x) has the type 1 extreme value distribution. See Extreme Value Distribution for more details.

nlogL = evlike(params,x,censoring) specifies whether each value in x is right-censored or not. Use the logical vector censoring to specify the value 1 for observations that are right-censored and 0 for observations that are fully observed.

nlogL = evlike(params,x,censoring,freq) specifies the frequency (or weights) of the observations. To specify freq without specifying censoring, you can pass [] for censoring.

[nlogL,aVar] = evlike(___) also returns the inverse of the Fisher information matrix aVar, using any of the input argument combinations in the previous syntaxes. 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.

example

Examples

collapse all

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

Generate 1000 random numbers from the type 1 extreme value distribution with the parameters 5 and 1.

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

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

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

    5.0269    0.9394

Compute the negative loglikelihood of the MLEs and the inverse of Fisher's information matrix.

[nlogL,aVar] = evlike(pHat,x)
nlogL = 
1.5174e+03
aVar = 2×2
10-3 ×

    0.9779   -0.2273
   -0.2273    0.5410

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

Input Arguments

collapse all

Extreme value distribution parameters, specified as a vector of two numeric values. params(1) and params(2) are the location and scale values, respectively. params(2) must be positive.

Data Types: single | double

Sample data, specified as a numeric vector.

Data Types: single | double

Indicator for the censoring of each value in x, specified as a logical vector of the same size as x. Use 1 for observations that are right-censored and 0 for observations that are fully observed.

The default is an array of 0s, meaning that all observations are fully observed.

Data Types: logical

Frequency (or weights) of the observations, specified as a nonnegative vector that is the same size as x. The freq input argument typically contains nonnegative integer counts for the corresponding elements in x, but can contain any nonnegative values.

To obtain the weighted negative loglikelihood for a data set with censoring, specify weights of observations, normalized to the number of observations in x.

The default is an array of 1s, meaning one observation per element of x.

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 2-by-2 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

evlike is a function specific to the 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",@evpdf) returns the asymptotic covariance matrix of the MLEs for the extreme value distribution.

  • Create an ExtremeValueDistribution 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.

Extended Capabilities

expand all

Version History

Introduced before R2006a