For a general implementation of the GEV in Base SAS (using PROC FCMP and the DATA step), see the article
Implement the generalized extreme value distribution in SAS - The DO Loop
which includes functions for the CDF, PDF, quantiles, and random variates.
> I would appreciate it if you could post the codes for pasting the data step for calculating the CDF of GEV into an proc IML module that we call for each value of simulated x data from uniform distribution.
OK. Here it is. See the article for additional IML modules that compute the CDF, PDF, quantile function, and random variates.
/* compute CDF in an IML function */
proc iml;
/* this function takes a single scalar value (x) and returns the
CDF(x) for the GEV(mu, sigma, xi) distribution */
start GEV_CDF(x, mu, sigma, xi);
if sigma <= 0 then return(.);
z = (x-mu)/sigma;
if xi=0 then
CDF = exp(-exp(-z));
else if xi^=0 & xi*z > -1 then
CDF = exp(-(1 + xi*z)##(-1/xi));
else if xi > 0 & z <= -1/xi then
CDF = 0;
else if xi < 0 & z >= 1/abs(xi) then
CDF = 1;
else
CDF = .;
return( CDF );
finish;
/* set the parameters */
mu = 10;
sigma = 2;
xi = 0.5;
/* compute the CDF function on [0,25] */
x = T(do(0,25,0.25));
CDF = j(nrow(x),1);
do i = 1 to nrow(x);
CDF[i] = GEV_CDF(x[i], mu, sigma, xi);
end;
/* visualize the CDF function */
title "CDF for GEV Distribution";
call series(x, CDF) grid={x y};
... View more