UV garch model forecasts

Discussions of ARCH, GARCH, and related models
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

I have for bootstrapped GJR-GARCH, nomean

compute c=%beta(1),a=%beta(2),b=%beta(3),d=%beta(4)

set stdu = %resids/sqrt(h)
set stdu bstart bend = h=( c + b*(h{1}) + a*(stdu{1}^2) + d*%if(stdu{1}<0.0,1.0,0.0)*(stdu{1}^2) ), stdu(entries(t)) * sqrt(h); * VARIANCE DRAW


And for non-bootstrapped GJR-GARCH, nomean

compute c=%beta(1),a=%beta(2),b=%beta(3),d=%beta(4)

compute hhat = ( c + b*(h(tend+i)) + a*(u(tend+i)^2) + d*%if(u(tend+i)<0.0,1.0,0.0)*(u(tend+i)^2) ); * VARIANCE


Correct?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

For bootstrap, no. The GJR recursion uses U's, not STDU's. The bootstrapped draws for STDU need to be scaled up by the standard deviation to create the U's. (You can't bootstrap the original U's because they all have different scales because of the time-varying volatility---that's why they need to be standardized to be useful).

For the other, only for the first step out. After the first step, the expected value for U^2 is H, and for U^2*(U<0) is .5xH. Please read the discussion in the User's Guide.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

I have for GJR-GARCH non-bootstrapped, in a backtest

1-step ahead variance: compute hhat = ( c + b*(h(tend+i)) + a*(u(tend+i)^2) + d*%if(u(tend+i)<0.0,1.0,0.0)*(u(tend+i)^2) )

Within a loop
s-step ahead variance: compute hhat = c + ( b + a + .5*d )*(h(tend+i))


And in GJR-GARCH bootstrap, I am not certain the formula and syntax are correct: The GJR recursion now uses U's, not STDU's - I think the stdu's have been scaled up by the standard deviation: stdu(entries(t))*sqrt(h).

set stdu = %resids/sqrt(h)
set stdu bstart bend = h=( c + b*(h{1}) + a*(u{1}^2) + d*%if(u{1}<0.0,1.0,0.0)*(u{1}^2) ), stdu(entries(t))*sqrt(h); * VARIANCE DRAW


What is the RATS code for the vanilla GARCH bootstrap forumla?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote:I have for GJR-GARCH non-bootstrapped, in a backtest

1-step ahead variance: compute hhat = ( c + b*(h(tend+i)) + a*(u(tend+i)^2) + d*%if(u(tend+i)<0.0,1.0,0.0)*(u(tend+i)^2) )

Within a loop
s-step ahead variance: compute hhat = c + ( b + a + .5*d )*(h(tend+i))
The RHS is the correct formula for H at TEND+I+1 given the calculations through TEND+I. It's hard to tell from that whether you properly feeding the calculations through correctly.
ac_1 wrote: And in GJR-GARCH bootstrap, I am not certain the formula and syntax are correct: The GJR recursion now uses U's, not STDU's - I think the stdu's have been scaled up by the standard deviation: stdu(entries(t))*sqrt(h).

set stdu = %resids/sqrt(h)
set stdu bstart bend = h=( c + b*(h{1}) + a*(u{1}^2) + d*%if(u{1}<0.0,1.0,0.0)*(u{1}^2) ), stdu(entries(t))*sqrt(h); * VARIANCE DRAW
No. It should be

set u (not stdu) bstart bend = ....

ac_1 wrote: What is the RATS code for the vanilla GARCH bootstrap forumla?
Isn't in the same thing but without the asymmetry term?
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

I have manually 'spot-checked' the GJR-GARCH non-bootstrapped forecasts, in a backtest, and they are being fed through correctly.

I have corrected the GJR-GARCH bootstrapped formulae:

set u bstart bend = h=( c + b*(h{1}) + a*(u{1}^2) + d*%if(u{1}<0.0,1.0,0.0)*(u{1}^2) ), u(entries(t)) * sqrt(h); * VARIANCE DRAW


1-step ahead VaR and ES can easily be calculated using GARCH 1-step ahead sqrt(variance) forecasts in backtests with violation ratios and associated statistical tests.

I can generate multi-step ahead GARCH forecasts. Question: can VaR and ES s-step ahead forecasts be simply calculated from s-step ahead sqrt(variance) i.e. hat forecasts using the usual formulae, assuming zero expected returns?

Var(s-step ahead) = -%invnormal(.01) * hat(s-step ahead) * value
ES(s-step ahead) = hat(s-step ahead) * %density(%invnormal(.99))/.01 * value

There is the square-root of time rule, which is applied to the 1-step ahead sqrt(variance) forecast :?:
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

The expected shortfall should actually use %invnormal(.01) not %invnormal(.99). The density is numerically the same, but you've made mistakes in the past by confusing the two.

If you are trying to analyze multiple period returns, then you have to sum the variance forecasts, since those are giving you the forecast of the variance of future *one-period* returns. Because the returns are assumed to be serially uncorrelated, the variance of (r(t+1)+r(t+2)+...+r(t+h)) given t is var(r(t+1))+...+var(r(t+h)) all computed given t. The square root rule comes into effect if those variances are all constant.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

GARCH:
- Yes, at EACH point in time I've accumulated the h-step ahead sigmasq forecasts: var(r(t+1))+...+var(r(t+h)) and sqrt'ed to calculate the accumulated sigma h-th step ahead forecast, and then calculated VaR and ES.
- The graphs for the accumulated h-th step ahead forecasts are higher and lag each other - that appears reasonable.
- However, the VaR violation ratio's = (number of violations/(number of OOS observations * 0.01)) are low e.g. 0.5, the longer the h-th step ahead. And I am questioning the use of vr's and especially associated tests for multi-period ahead forecasts? I have read for coverage tests the expected number of violations should be at least 10 i.e. 10 * 100 for 1% violation = 1000 points. But even with 1000 points OOS I'd expect a vr = 0.5 (5 violations) not to have a p-value of e.g. 0.08; vr=0.5 is 'not near' vr=1 (the null) for Kupiec.

EWMA or IGARCH, and MA: I have moved forward the 1-step ahead forecasts (i.e. the last filtered value) by 1 period, for each h-th-step ahead, and accumulated. Is that reasonable?

(GARCH models assume conditional heteroscedasticity i.e. time-changing variance).
Historical Simulation: Is just a re-ordering of the returns, is the square-root of time rule (assumes IID and normality) applicable to the 1-step forecast's, to obtain the h-th step ahead forecasts?


What about PI's for non-bootstrapped and bootstrapped multi-period VaR and ES forecasts?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote: - However, the VaR violation ratio's = (number of violations/(number of OOS observations * 0.01)) are low e.g. 0.5, the longer the h-th step ahead. And I am questioning the use of vr's and especially associated tests for multi-period ahead forecasts? I have read for coverage tests the expected number of violations should be at least 10 i.e. 10 * 100 for 1% violation = 1000 points. But even with 1000 points OOS I'd expect a vr = 0.5 (5 violations) not to have a p-value of e.g. 0.08; vr=0.5 is 'not near' vr=1 (the null) for Kupiec.
No. That sounds correct. These are events with very low probabilities. You might want to review your statistics on binomial distributions.
ac_1 wrote: EWMA or IGARCH, and MA: I have moved forward the 1-step ahead forecasts (i.e. the last filtered value) by 1 period, for each h-th-step ahead, and accumulated. Is that reasonable?
(GARCH models assume conditional heteroscedasticity i.e. time-changing variance).
That's the correct procedure. They *are* time-varying. That doesn't mean that the out-of-sample variance forecasts can't be constant.
ac_1 wrote: Historical Simulation: Is just a re-ordering of the returns, is the square-root of time rule (assumes IID and normality) applicable to the 1-step forecast's, to obtain the h-th step ahead forecasts?
I have no idea what you're trying to say.
ac_1 wrote: What about PI's for non-bootstrapped and bootstrapped multi-period VaR and ES forecasts?
That doesn't make sense. Try to explain what a 95% PI on a 1% VaR means. 1% should mean 1%, and should take into account whatever uncertainty you have.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

Based on egarchbootstrap.rpf and egarchsimulate.rpf, how do I calculate VaR and ES from a bootstrap and from a simulation, as

set VaR = -%invnormal(.01)*fmean*value
set ES = fmean*%density(%invnormal(.01))/.01 * value

presume normality?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

Those are done with the sample equivalents of their definitions: minus the 1%-ile and minus the mean of values at and below the 1%-ile. See GARCHBOOT.RPF.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

Thanks :!:


GARCH: VaR and ES

I have used GARCHBOOT.RPF, and adapted for GJR-GARCH:

compute chat=%beta(1),ahat=%beta(2),bhat=%beta(3),dhat=%beta(4)
frml hf =( chat + bhat*(h{1}) + ahat*(u{1}^2) + dhat*%if(u{1}<0.0,1.0,0.0)*(u{1}^2) )

Presumably for a simulation I only change?

set udraw gend+1 gend+span = %ran(1.0)

Correct?


EGARCH: VaR and ES

Based on EGARCHBOOTSTRAP.RPF, GARCHBACKTEST.RPF, to generate VaR and ES bootstrap OOS forecasts, as a backtest, I need to estimate the quantile(s) of the random draws from the original standardized returns series, at EACH step. Therefore, I have

declare vector[real] q01(iend-ibegin+1)

Then, within the t1 backtest loop, and after the end do draw loop

sstats(frac=.01) gstart gend stdu>>qq01; * the .01 quantile(s) of the random draws from the original standardized returns series
comp q01(t1+1) = qq01

Then, at the end of the t1 loop, set q01 as a series

set sq01 ibegin+1 iend+1 = q01(t-window-1)

Then,

set mean ibegin+1 iend+1 = %avg(hdraws(t))
set fmean window+1+1 %allocend()+1 = sqrt(mean)
set sVaR_1 window+1+1 %allocend()+1 = -sq01*fmean*value

Which is for 1-step ahead OOS forecasts. For cumulative multi-step OOS ahead I have re-aligned the sq01 series (and named as sq02, sq03, etc), lagged forwards.


What is Expected Shortfall?

set sES_1 window+1+1 %allocend()+1 = ?

As with GARCHBOOT.RPF, es is calculated as

sstats(mean) 1 ndraws %if(returns(t)<VaR(i),returns(t),%na)>>es


Or do I use GARCHBOOT.RPF instead for EGARCH? With the formulae as:

compute chat=%beta(1),ahat=%beta(2),bhat=%beta(3),dhat=%beta(4)
frml hf =exp( chat + bhat*log(h{1}) + ahat*abs(u{1}) + dhat*%max(u{1},0.0) )
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote:Thanks :!:


GARCH: VaR and ES

I have used GARCHBOOT.RPF, and adapted for GJR-GARCH:

compute chat=%beta(1),ahat=%beta(2),bhat=%beta(3),dhat=%beta(4)
frml hf =( chat + bhat*(h{1}) + ahat*(u{1}^2) + dhat*%if(u{1}<0.0,1.0,0.0)*(u{1}^2) )

Presumably for a simulation I only change?

set udraw gend+1 gend+span = %ran(1.0)

Correct?
Yes.
ac_1 wrote: EGARCH: VaR and ES

Based on EGARCHBOOTSTRAP.RPF, GARCHBACKTEST.RPF, to generate VaR and ES bootstrap OOS forecasts, as a backtest, I need to estimate the quantile(s) of the random draws from the original standardized returns series, at EACH step. Therefore, I have

declare vector[real] q01(iend-ibegin+1)

Then, within the t1 backtest loop, and after the end do draw loop

sstats(frac=.01) gstart gend stdu>>qq01; * the .01 quantile(s) of the random draws from the original standardized returns series
comp q01(t1+1) = qq01
No. Not even close. The only difference between EGARCH and GARCH is the recursion for generating the draws. What you do with the draws is the same. The three examples (EGARCHBOOTSTRAP and EGARCHSIMULATE are effectively the same) show three different types of analysis and show two different types of models. The generation of data for a particular model type is completely separate from what you end up doing with it.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

I have decided to include the Expected Mean, assuming non-zero mean returns, (as this will generalize the code for other series), both for VaR and ES, in GARCH and GJR-GARCH estimations, but not for IGARCH as per Riskmetrics.

TomDoan wrote: No. Not even close. The only difference between EGARCH and GARCH is the recursion for generating the draws. What you do with the draws is the same. The three examples (EGARCHBOOTSTRAP and EGARCHSIMULATE are effectively the same) show three different types of analysis and show two different types of models. The generation of data for a particular model type is completely separate from what you end up doing with it.
Is this the recursion for generating the EGARCH draws including a mean, in GARCHBOOT.RPF?

compute c=%beta(2),a=%beta(3),b=%beta(4),d=%beta(5)
frml hf=exp( c + b*log(h{1}) +a*abs(u{1}) + d*%max(u{1},0.0) )
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

You need a space between HF and =, but otherwise, that's the recursion for doing the variance of the EGARCH allowing for the coefficient on the mean in the estimates. You get a simulated value for the process itself by X = mean + U, where U is the simulated value of the GARCH residual.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

1. EGARCH
Based on GARCHBOOT.RPF (which works well for GARCH & GJR-GARCH), I am having problems with EGARCH bootstrapped & simulated multi-step ahead VaR and ES values: e.g. for h-step greater than 3 (say) they occasionally blow-up despite converged estimations. Why would that be and how do I resolve?


2. Density plots
From GARCHSEMIPARAM.RPF, the following defines the empirical density of standardized residuals from a garch model i.e. the fitted garch distribution relative to the standard Normal.

Code: Select all

set ustandard gstart gend = u/sqrt(h)
@gridseries(from=-6.0,to=6.0,size=.001,pts=gpts) xgrid
density(type=gauss,grid=input) ustandard gstart gend xgrid fgrid
set ngrid 1 gpts = %density(xgrid)
scatter(style=line,key=upleft,klabels=||"Empirical","N(0,1)"||) 2
# xgrid fgrid
# xgrid ngrid
What information do I require and how do I plot TOOS multi-step ahead density forecasts from garch processes: analytical, bootstrapped & simulated?
Post Reply