Why does gevcdf with shape of zero result in different answer than evcdf?
Show older comments
And the gevcdf function returns the Generalized Extreme Value (GEV) distribution function with a shape parameter as an input. If the shape parameter is zero, then the GEV distribution becomes the Gumbel distribution.
So, why doesn't gevcdf with a shape parameter of zero give the same answer as evcdf?
(Note that the documentation shows the gevcdf and evcdf have the mu and sigma parameters switched which is just confusing...but I think I have accounted for it properly here).
%X variable
xgrid = linspace(1,10,100);
% Compute the GEV CDF for the range of block maxima
shapek = 0; %shape parameter
scaleSigma = 0.5; %sigma parameter
locMu = 1; %mu parameter
%Gumbel distribution using evcdf
pgumb = evcdf(xgrid,locMu,scaleSigma);
%Gumbel distribution using GEV
%shapek = 0 for Gumbel
pgev = gevcdf(xgrid, shapek,scaleSigma,locMu);
%logarithm of return period (see Coles, 2001)
ypgev = -log(1-pgev);
ypgumb = -log(1-pgumb);
figure(2)
plot(ypgev,xgrid,'-','LineWidth',1.5); hold on
plot(ypgumb,xgrid,'--r','LineWidth',1.5);
title(['\sigma = ',num2str(scaleSigma),', \mu = ',num2str(locMu)])
legend('Type 1 GEV., k=0','EVCDF')
xlabel('Return Period')
ylabel('Value')
grid on

Answers (1)
Hi Darcy,
The discrepancy arises because the “evcdf” function is designed to model minima, while the “gevcdf” function with (k = 0) models maxima by default. This difference in modelling leads to the observed variance in results. For this, there is a workaround for either modelling minima with both or maxima with both as follows:
- Modeling Minima - The given code modifies the use of “gevcdf” to model minima by inverting the “xgrid” and location parameter (-“xgrid” and –“locMu”). This allows the GEV distribution to represent minima, aligning with how “evcdf” inherently models minima.
% Parameters
xgrid = linspace(1, 10, 100);
shapek = 0; % Shape parameter for GEV
scaleSigma = 0.5; % Scale parameter (sigma)
locMu = 1; % Location parameter (mu)
% Minima using evcdf
pgumb = evcdf(xgrid, locMu, scaleSigma);
% Minima using gevcdf
pgev = 1 - gevcdf(-xgrid, shapek, scaleSigma, -locMu);
% Plotting
figure;
plot(-log(1 - pgev), xgrid, '-', 'LineWidth', 1.5); hold on;
plot(-log(1 - pgumb), xgrid, '--r', 'LineWidth', 1.5);
title(['\sigma = ', num2str(scaleSigma), ', \mu = ', num2str(locMu)])
legend('GEV Minima', 'EVCDF Minima')
xlabel('Return Period')
ylabel('Value')
grid on;
- Modeling Maxima - The given code introduces an alternative approach to model maxima using “evcdf” by flipping the “xgrid” and location parameter (-“xgrid” and –“locMu”). This adjustment makes the use of “evcdf” consistent with modeling maxima, similar to how “gevcdf” operates by default.
% Parameters
xgrid = linspace(1, 10, 100);
shapek = 0; % Shape parameter for GEV
scaleSigma = 0.5; % Scale parameter (sigma)
locMu = 1; % Location parameter (mu)
% Maxima using evcdf
pgumb_max = 1 - evcdf(-xgrid, -locMu, scaleSigma);
% Maxima using gevcdf
pgev_max = gevcdf(xgrid, shapek, scaleSigma, locMu);
% Plotting
figure;
plot(-log(1 - pgev_max), xgrid, '-', 'LineWidth', 1.5); hold on;
plot(-log(1 - pgumb_max), xgrid, '--r', 'LineWidth', 1.5);
title(['\sigma = ', num2str(scaleSigma), ', \mu = ', num2str(locMu)])
legend('GEV Maxima', 'EVCDF Maxima')
xlabel('Return Period')
ylabel('Value')
grid on;
I hope this helps with your issue.
Categories
Find more on Generalized Extreme Value Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!