Categories &

Functions List

Function Reference: evfit

statistics: paramhat = evfit (x)
statistics: [paramhat, paramci] = evfit (x)
statistics: [paramhat, paramci] = evfit (x, alpha)
statistics: […] = evfit (x, alpha, censor)
statistics: […] = evfit (x, alpha, censor, freq)
statistics: […] = evfit (x, alpha, censor, freq, options)

Estimate parameters and confidence intervals for the extreme value distribution.

paramhat = evfit (x) returns the maximum likelihood estimates of the parameters of the extreme value distribution (also known as the Gumbel or the type I generalized extreme value distribution) given the data in x. paramhat(1) is the location parameter, mu, and paramhat(2) is the scale parameter, sigma.

[paramhat, paramci] = evfit (x) returns the 95% confidence intervals for the parameter estimates.

[…] = evfit (x, alpha) also returns the 100 * (1 - alpha) percent confidence intervals for the parameter estimates. By default, the optional argument alpha is 0.05 corresponding to 95% confidence intervals. Pass in [] for alpha to use the default values.

[…] = evfit (x, alpha, censor) accepts a boolean vector, censor, of the same size as x with 1s for observations that are right-censored and 0s for observations that are observed exactly. By default, or if left empty, censor = zeros (size (x)).

[…] = evfit (x, alpha, censor, freq) accepts a frequency vector, freq, of the same size as x. freq typically contains integer frequencies for the corresponding elements in x, but it can contain any non-integer non-negative values. By default, or if left empty, freq = ones (size (x)).

[…] = evfit (…, options) specifies control parameters for the iterative algorithm used to compute the maximum likelihood estimates. options is a structure with the following field and its default value:

  • options.Display = "off"
  • options.MaxFunEvals = 400
  • options.MaxIter = 200
  • options.TolX = 1e-6

The Gumbel distribution is used to model the distribution of the maximum (or the minimum) of a number of samples of various distributions. This version is suitable for modeling minima. For modeling maxima, use the alternative Gumbel fitting function, gumbelfit.

Further information about the Gumbel distribution can be found at https://en.wikipedia.org/wiki/Gumbel_distribution

See also: evcdf, evinv, evpdf, evrnd, evlike, evstat, gumbelfit

Source Code: evfit

Example: 1

 

 ## Sample 3 populations from different extreme value distibutions
 rand ("seed", 1);    # for reproducibility
 r1 = evrnd (2, 5, 400, 1);
 rand ("seed", 12);    # for reproducibility
 r2 = evrnd (-5, 3, 400, 1);
 rand ("seed", 13);    # for reproducibility
 r3 = evrnd (14, 8, 400, 1);
 r = [r1, r2, r3];

 ## Plot them normalized and fix their colors
 hist (r, 25, 0.4);
 h = findobj (gca, "Type", "patch");
 set (h(1), "facecolor", "c");
 set (h(2), "facecolor", "g");
 set (h(3), "facecolor", "r");
 ylim ([0, 0.28])
 xlim ([-30, 30]);
 hold on

 ## Estimate their MU and SIGMA parameters
 mu_sigmaA = evfit (r(:,1));
 mu_sigmaB = evfit (r(:,2));
 mu_sigmaC = evfit (r(:,3));

 ## Plot their estimated PDFs
 x = [min(r(:)):max(r(:))];
 y = evpdf (x, mu_sigmaA(1), mu_sigmaA(2));
 plot (x, y, "-pr");
 y = evpdf (x, mu_sigmaB(1), mu_sigmaB(2));
 plot (x, y, "-sg");
 y = evpdf (x, mu_sigmaC(1), mu_sigmaC(2));
 plot (x, y, "-^c");
 legend ({"Normalized HIST of sample 1 with μ=2 and σ=5", ...
          "Normalized HIST of sample 2 with μ=-5 and σ=3", ...
          "Normalized HIST of sample 3 with μ=14 and σ=8", ...
          sprintf("PDF for sample 1 with estimated μ=%0.2f and σ=%0.2f", ...
                  mu_sigmaA(1), mu_sigmaA(2)), ...
          sprintf("PDF for sample 2 with estimated μ=%0.2f and σ=%0.2f", ...
                  mu_sigmaB(1), mu_sigmaB(2)), ...
          sprintf("PDF for sample 3 with estimated μ=%0.2f and σ=%0.2f", ...
                  mu_sigmaC(1), mu_sigmaC(2))})
 title ("Three population samples from different extreme value distibutions")
 hold off

                    
plotted figure