gevfit
              Estimate parameters and confidence intervals for the generalized extreme value (GEV) distribution.
 paramhat = gevfit (x) returns the maximum likelihood
 estimates of the parameters of the GEV distribution given the data in
 x.  paramhat(1) is the shape parameter, k, and
 paramhat(2) is the scale parameter, sigma, and
 paramhat(3) is the location parameter, mu.
 [paramhat, paramci] = gevfit (x) returns the 95%
 confidence intervals for the parameter estimates.
 […] = gevfit (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.
 […] = gevfit (…, 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 = 1000
 options.MaxIter = 500
 options.TolX = 1e-6
  When k < 0, the GEV is the type III extreme value distribution.
 When k > 0, the GEV distribution is the type II, or Frechet,
 extreme value distribution.  If W has a Weibull distribution as
 computed by the wblcdf function, then -W has a type III
 extreme value distribution and 1/W has a type II extreme value
 distribution.  In the limit as k approaches 0, the GEV is the
 mirror image of the type I extreme value distribution as computed by the
 evcdf function.
 The mean of the GEV distribution is not finite when k >= 1, and
 the variance is not finite when k >= 1/2.  The GEV distribution
 has positive density only for values of x such that
 k * (x - mu) / sigma > -1.
Further information about the generalized extreme value distribution can be found at https://en.wikipedia.org/wiki/Generalized_extreme_value_distribution
See also: gevcdf, gevinv, gevpdf, gevrnd, gevlike, gevstat
Source Code: gevfit
| 
 ## Sample 2 populations from 2 different exponential distibutions
 rand ("seed", 1);   # for reproducibility
 r1 = gevrnd (-0.5, 1, 2, 5000, 1);
 rand ("seed", 2);   # for reproducibility
 r2 = gevrnd (0, 1, -4, 5000, 1);
 r = [r1, r2];
 ## Plot them normalized and fix their colors
 hist (r, 50, 5);
 h = findobj (gca, "Type", "patch");
 set (h(1), "facecolor", "c");
 set (h(2), "facecolor", "g");
 hold on
 ## Estimate their k, sigma, and mu parameters
 k_sigma_muA = gevfit (r(:,1));
 k_sigma_muB = gevfit (r(:,2));
 ## Plot their estimated PDFs
 x = [-10:0.5:20];
 y = gevpdf (x, k_sigma_muA(1), k_sigma_muA(2), k_sigma_muA(3));
 plot (x, y, "-pr");
 y = gevpdf (x, k_sigma_muB(1), k_sigma_muB(2), k_sigma_muB(3));
 plot (x, y, "-sg");
 ylim ([0, 0.7])
 xlim ([-7, 5])
 legend ({"Normalized HIST of sample 1 with ξ=-0.5, σ=1, μ=2", ...
          "Normalized HIST of sample 2 with ξ=0, σ=1, μ=-4",
     sprintf("PDF for sample 1 with estimated ξ=%0.2f, σ=%0.2f, μ=%0.2f", ...
                 k_sigma_muA(1), k_sigma_muA(2), k_sigma_muA(3)), ...
     sprintf("PDF for sample 3 with estimated ξ=%0.2f, σ=%0.2f, μ=%0.2f", ...
                 k_sigma_muB(1), k_sigma_muB(2), k_sigma_muB(3))})
 title ("Two population samples from different exponential distibutions")
 hold off
                     | 
