MATLAB: How to solve cdfs of the general extreme value distribution for x

general extreme valuegevgevcdfsolve

Assume parameters k, sigma and mu of the GEV distribution are given. A probability level lambda is given too. How can I solve the gevcdf(..)=lambda for x? I cannot use "gevinv" because it is used within a large equation. For example:
lambda = 0.95; %close to 1
N = 1000;
n = 5; %block size
m = floor(N/n);
%GEV model, parameters a_0, b_0, y_0
b_0 = 1.0e+03 *0.8368;%location
a_0 = 1.0e+03 *1.7127;%scale
gamma_0 = 1.0e+03 *0.0007;%shape
%find alpha
alph = 2;
%find divergence estimator delta
delta = 0.04;
if alph > 1
delta_quer = exp((alph-1)*delta);
elseif alph == 1
delta_quer = delta;
end
u = lambda^n;
eqn1 = 1 - gevcdf(x, gamma_0,a_0,b_0);
if alph >1
eqn2 = eqn1* ((1-u)/eqn1)^alph + (1-eqn1) * (u/(1-eqn1))^alph;
elseif alph == 1
eqn2 = eqn1* ((1-u)/eqn1)*log((1-u)/eqn1) + (1-eqn1) * (u/(1-eqn1))*log(u/(1-eqn1));
end
xhat_p = solve(eqn2==delta_quer,x)
I always get the ERROR saying "Error using gevcdf>localgevcdf (line 65) Inputs must be floats, namely single or double.
Error in gevcdf (line 49) [varargout{1:max(1,nargout)}] = localgevcdf(x,uflag,varargin{:});
Error in Blanchet_VaR (line 51) eqn1 = 1 – gevcdf(x, gamma_0,a_0,b_0);"

Best Answer

Solve the equation
eqn2 = delta_quer
such that it reads
1 - eqn1 = expression of delta_quer, alph and u
Then you can directly apply "gevinv" to "expression of delta_quer, alph and u".
Best wishes
Torsten.