# Calculate VaR using the extreme value theory

I am trying to calculate the Value at Risk for different models. But I am now confused for some reason. Could you please help me?

I calculate the 1% and 5% VaR (so negative numbers) and I am also calculating the VaR using EVT. I was looking at some papers on this topic. y_in are the returns and V0_in are the conditional volatilities.

stres = (y_in)./sqrt(V0_in);
epssort = sortrows(stres(:,1),-1);
psi = alpha + 0.02;
trunres = epssort(ceil(psi*T));
eps = epssort(epssort>trunres);
[par] = gpfit(eps-trunres);
xi = par(1);
beta = par(2);
z = trunres + beta/xi*(((alpha/(size(eps,1)/size(stres,1)))^(-xi)-1));
V0_out(1) = info.X(1)/(1-info.X(2)-info.X(3));
VaR_GARCH_in = -sqrt(V0_in)*z;


I am looking at the positive residual numbers. In the last stage I multiply the z with a minus, otherwise I don't get a negative number. But is this correct?

Thank you so much.