Page 1 of 1
Extreme Value Theory (EVT): Hill estimator
Posted: Sun Jan 18, 2026 3:02 am
by ac_1
Hi Tom,
Here's my loop for risk algo Historical Simulation (HS), calculate VaR and ES:
Code: Select all
*===============================
do i = 1, %allocend() - WIN
*
clear dlp1
clear y
set dlp1 1+i WIN+i = dlp
order(index=ix,nodecreasing) dlp1 1+i WIN+i
set y 1+i WIN+i = dlp1(ix)
comp op = fix(WIN*alpha)+i; * alpha smallest
comp VaR = - y(op) * SCALE
sstats(mean) 1+i fix(WIN*alpha)+i y>>mu
comp ES = - mu * SCALE
comp VaR_1(WIN+1+i) = VaR
comp ES_1(WIN+1+i) = ES
disp 'obs' WIN+i+1 'HS 1% VaR=' VaR 'HS 1% ES=' ES
*
end do i
I ought to get a similar picture of multi-step ahead forecasts (sqrt-of-time) for
Extreme Value Theory (EVT): Hill estimator, even though HS and EVT are completely different methods.
How would I implement EVT in RATS?
Amarjit
Re: Extreme Value Theory (EVT): Hill estimator
Posted: Mon Jan 19, 2026 8:02 am
by TomDoan
Tsay's book has a whole chapter (Chapter 7) on that. There are four examples in the textbook examples.
Re: Extreme Value Theory (EVT): Hill estimator
Posted: Mon Jan 19, 2026 1:09 pm
by ac_1
Thanks! Based on the HS loop (fixed rolling window) and using @HillGEV, it would be something like the following, however what are the formulae for VaR and ES as positive numbers?
Code: Select all
comp WIN = 1000
comp SCALE = 100.0
comp CT = 100; * threshold for tail observations
*===============================
do i = 1, %allocend() - WIN
*
clear dlp1
clear y
clear ysort
set dlp1 1+i WIN+i = dlp
set y 1+i WIN+i = -dlp1
order(index=ix,nodecreasing) y 1+i WIN+i
set ysort 1+i WIN+i = y(ix)
@HillGEV(span=CT,tail=left) ysort 1+i WIN+i
sstat 1+i i+CT %%hill>>sumlog
comp iota = -(CT/sumlog)
if iota <= 1.0 {
comp VaR_EVT = %NA
comp ES_EVT = %NA
}
comp threshold = ysort(i+CT+1) * SCALE
comp VaR_EVT = ?
comp ES_EVT = ?
comp VaR_1(WIN+1+i) = VaR_EVT
comp ES_1(WIN+1+i) = ES_EVT
disp 'obs' WIN+i+1 'EVT iota=' iota 'VaR=' VaR_EVT 'ES=' ES_EVT
*
end do i
Although, @HillGEV is designed for GEV asymptotics, not classical Pareto Hill estimator:
1/ihat = (1/k) summation from j=1 to k [log( X(j)/X(k+1))].
I'd like the classical estimator to complement various risk algos.
So, maybe:
Code: Select all
set logratios 1+i WE+i = log( ysort / ysort(i+CT+1) )
sstat 1+i i+CT logratios>>sumlog
comp iota = CT / sumlog
comp VaR_EVT = ?
comp ES_EVT = ?
?
Re: Extreme Value Theory (EVT): Hill estimator
Posted: Tue Jan 20, 2026 8:49 am
by TomDoan
ac_1 wrote: ↑Mon Jan 19, 2026 1:09 pm
Although, @HillGEV is designed for GEV asymptotics, not classical Pareto Hill estimator:
1/ihat = (1/k) summation from j=1 to k [log( X(j)/X(k+1))].
I'd like the classical estimator to complement various risk algos.
That's what the procedure computes.
Re: Extreme Value Theory (EVT): Hill estimator
Posted: Tue Jan 20, 2026 2:07 pm
by ac_1
TomDoan wrote: ↑Tue Jan 20, 2026 8:49 am
ac_1 wrote: ↑Mon Jan 19, 2026 1:09 pm
Although, @HillGEV is designed for GEV asymptotics, not classical Pareto Hill estimator:
1/ihat = (1/k) summation from j=1 to k [log( X(j)/X(k+1))].
I'd like the classical estimator to complement various risk algos.
That's what the procedure computes.
Alright if I use
Code: Select all
@HillGEV(span=CT,tail=left) ysort 1+i WIN+i
sstat 1+i i+CT %%hill>>sumlog
comp iota = -(CT/sumlog)
comp threshold = ysort(i+CT+1) * SCALE
then what are the VaR_EVT and ES_EVT formulae?
Code: Select all
comp VaR_EVT = TSay (2010), p.355, eqn (7.28), if so, how do I extract alphahat, betahat, Xihat from the procedure? Or is there another VaR_EVT formulae?
comp ES_EVT = ?
Re: Extreme Value Theory (EVT): Hill estimator
Posted: Wed Jan 21, 2026 11:01 am
by TomDoan
The tail index doesn't provide enough information to compute the VaR and the ES. Those need complete distributions. tsay3p355 does that. The thing to note is that the results are sensitive to the number of extreme values that are included, which is the point of the earlier search.
Re: Extreme Value Theory (EVT): Hill estimator
Posted: Thu Jan 22, 2026 2:31 am
by ac_1
TomDoan wrote: ↑Wed Jan 21, 2026 11:01 am
The tail index doesn't provide enough information to compute the VaR and the ES. Those need complete distributions. tsay3p355 does that. The thing to note is that the results are sensitive to the number of extreme values that are included, which is the point of the earlier search.
Are you saying I cannot do a rolling analysis: fixed window T=1000, n=100 (the tail), p=0.01, in each loop,
EVT method, and calculate VaR and ES using
@HILLGEV, but rather using
nonlin alpha beta k
dec series r
compute alpha=.8,beta=-2.0,k=-.2; * guess values
frml gevmin = %loggevdensity(-r,k,-beta,alpha)
maximize(METHOD=BFGS) gevmin 1 gend
compute var01=%invgev((1-.01)**n,k,-beta,alpha)
?
I am not certain how to proceed, given my aim: backtest and forecast multi-step ahead VaR and ES using EVT to complement other various risk algos.
Re: Extreme Value Theory (EVT): Hill estimator
Posted: Thu Jan 22, 2026 7:32 am
by TomDoan
Is there a reason you can't put that in a loop?
If you want the ES for a GEV, you will have to find someone who has figured that out.