UV garch model forecasts

Discussions of ARCH, GARCH, and related models
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote: A few more questions:-

[A] Interpretation:

As coded in the rpf file, dlogdm=log(dm/dm{1}), log returns are time additive; the portfolio value is value=100, and ftrigger=VaR/value.
Now let's say e.g. VaR=2.6, this can be interpreted as 2.6% is at risk on the portfolio value: be it 1,000 USD, 10,000 USD or x USD in value. In otherwords, a probability p=0.01 (say) of losses >= to 2.6% on any USD sized portfolio. Correct?

E.g. For FX, from the point-of-view of a dollar investor, I would model USD/XXX, as that would be XXX per 1 USD, and based on the 100 USD portfolio the 2.6% loss would be in terms of USD. Correct?
Returns to USD/XXX and XXX/USD are signed opposites of each other. USD/XXX would give you USD per xxx (literally---that's what / means), not the other way around. In GARCHUV.RPF, the data are in USD/DM so, as written, that would be analyzing returns in holding DM's.
ac_1 wrote: B Also, in GARCHBACKTEST.rpf there's:

(i) Kupiec POF measure:
observed alpha matching the chosen one,
- 0 indicating no evidence of any inadequacy
- >0 VaR model either systematically understates or overstates the portfolio’s underlying level of risk.
Is there a p-value?
That's a very poor description of what this means. It's 0 if the sample probability hits spot on with the assigned alpha. It's positive if it's anything else (which of course would be true almost every time). The question is whether it is big enough to cast doubt on the assumed alpha. And yes, it would reject if the number of trigger events is either too large or too small.

In this form, it's an LR statistic which asymptotically will be chi-squared with 1.

ac_1 wrote: (ii) Christofferson Markov independence measure: H0: independence, H0: no independence.
Is there a p-value?
That's also a chi-squared with 1.
ac_1 wrote: C Within a bootstrapping framework I'd like to try the less standard GARCH model's as in GARCHUVMAX.RPF. Which one's would be appropriate in addition to EGARCH for financial returns?
I have no idea. Most of those came out of a survey paper---I don't know if anyone ever did a serious test of which (if any) actually performed better than more standard models.
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote: A general and important question regarding plotting DAILY UNDATED or IRREGULAR series: on the x-axis how to show the DATES not the ENTRY numbers?
If you have the date information:

https://estima.com/ratshelp/juliandates ... ndars.html

If you don't (for instance, G10XRATES.XLS doesn't), there really isn't anything you can do.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

1) Daily dates

I have managed to read in the IRREGULAR dates

data(format=prn,nolabels,org=columns,top=2) 1 %allocend() year month day close
cal(julian=%julianfromymd(year,month,day))

having converted the dates in Excel from
10/09/1998 123.456
to
1998 9 10 123.456

via year() month() day() and concatenating.

Isn't there a way to read in the dates in the original format 10/09/1998 in RATS, and then converting?

For TOOS forecasting I do not know the IRREGULAR business daily days ahead. If the last date T is 01/09/2023 in the data file, it would be very useful to display T repeated in the ENTRIES in a graph for multistep ahead TOOS forecasts as

ENTRY
01/09/2023+1
01/09/2023+2
etc etc
01/09/2023+50 (say)

i.e. anchored on the last date, instead of having just the last date repeated 01/09/2023, TOOS times.


2) Log returns

There are many reasons why log rets vs simple returns are used in data analysis:
- log returns combine linearly over time.
- the log function suppresses big positive values while emphasizing small negative values.
- log rets are more symmetric then simple rets.
- etc

According to Tsay AFTS(2010):
Since log returns correspond approximately to percentage changes in value of a financial asset, we use log returns in data analysis.

But doesn't say exactly why in VaR?

And further says:
The dollar amount of VaR is then the cash value of the financial position times the VaR of the log return series.
That is, VaR = Value × VaR(of log returns).
If necessary, one can also use the approximation VaR = Value × [exp(VaR of log returns) − 1].

But the unlogged VaR ought to be standard? Investors are interested in actual monetary terms, not a log return.

Thus, instead of VaR being

set VaR ibegin+1 iend+1 = -%invnormal(.01)*fmean*value

The dollar amount of VaR can be approximated by

set VaR ibegin+1 iend+1 = (exp(-%invnormal(.01)*fmean)-1)*value


and instead of Expected Shortfall being

set ES ibegin+1 iend+1 = fmean*%density(%invnormal(.99))/.01 * value

The dollar amount of ES can be approximated by

set ES ibegin+1 iend+1 = exp((fmean*%density(%invnormal(.99))/.01)-1)*value

Correct?

And, shouldn't the dollar unlogged amount be displayed in exceedence plots? But log returns are more symmetric vs. simple returns, and is that the (only) reason why can VaR can be minusVaR in the graphs, hence computing violation ratio's? Also there's consistency. It's standard practice for GARCH models to be based on log returns not simple returns?


3) For one-step ahead forecasts, which are deterministic, why do more than comp ndraws=1 as h is the same regardless? As e.g. within the draw loop if comp draws=5 (say)

disp hdraws(t)
0.00765 0.00000 0.00000 0.00000 0.00000
0.00765 0.00765 0.00000 0.00000 0.00000
0.00765 0.00765 0.00765 0.00000 0.00000
0.00765 0.00765 0.00765 0.00765 0.00000
0.00765 0.00765 0.00765 0.00765 0.00765


4) Multistep head forecasts

As with SKIPSAVE in FORECAST or

compute rhat12(regend+12)=rhat(regend+12)

How do I gather the nth step ahead multistep forecast within the t1 loop?

Code: Select all

*===============================
compute ndraws=10000
compute nsteps=50


*===============================
infobox(action=define,lower=0,upper=(iend-ibegin),progress) "egarchbootstrap Model Backtest"

do t1 = 0, (iend-ibegin)
   *
   garch(p=1,q=1,exp,asymmetric,hseries=h,noprint,METHOD=BFGS) istart+t1 ibegin+t1 dlogdm
   *
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=BHHH) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=SIMPLEX) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=GENETIC) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=ANNEALING) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=GA) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=EVALUATE) istart+t1 ibegin+t1 dlogdm
   *
   if (%converged == 0); disp 'Fail'
   *
   compute c=%beta(2),a=%beta(3),b=%beta(4),d=%beta(5)
   compute gstart=istart+t1,gend=ibegin+t1
   *
   set stdu = %resids/sqrt(h)
   *
   compute bstart=gend+1,bend=gend+nsteps
   set h bstart bend = %na
   *
   gset hdraws bstart bend = %zeros(ndraws,1)
   *
   * Compute the one-step bootstrap forecast for the variance
   *
   do draw=1,ndraws
      boot entries bstart bend gstart gend
      *
      set stdu bstart bend = h=sqrt(exp(c+b*log(h{1})+a*abs(stdu{1})+d*%max(stdu{1},0.0))),stdu(entries(t))
      do t=bstart,bend
         compute hdraws(t)(draw)=h(t)
      end do t
   end do draw
   *
   infobox(current=t1) "Model converged "+%converged
end do t1
infobox(action=remove)
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote:1) Daily dates

I have managed to read in the IRREGULAR dates

data(format=prn,nolabels,org=columns,top=2) 1 %allocend() year month day close
cal(julian=%julianfromymd(year,month,day))

having converted the dates in Excel from
10/09/1998 123.456
to
1998 9 10 123.456

via year() month() day() and concatenating.

Isn't there a way to read in the dates in the original format 10/09/1998 in RATS, and then converting?
Sure. That's what the JULIAN option on DATA is for. That's the first example on the page describing the mapped dates.
ac_1 wrote: For TOOS forecasting I do not know the IRREGULAR business daily days ahead. If the last date T is 01/09/2023 in the data file, it would be very useful to display T repeated in the ENTRIES in a graph for multistep ahead TOOS forecasts as

ENTRY
01/09/2023+1
01/09/2023+2
etc etc
01/09/2023+50 (say)

i.e. anchored on the last date, instead of having just the last date repeated 01/09/2023, TOOS times.
You can always extend it yourself if you are so inclined. The software should not assume something in a situation like this. I'm not even sure why it matters---in practice, no one cares about the out-of-sample GARCH variance forecasts other than for calculating something like VaR which is dated to an actual data point. If you find the date labeling distracting, use the NODATES option.

(Questions regarding log returns should be directed towards a finance blog).
ac_1 wrote: 3) For one-step ahead forecasts, which are deterministic, why do more than comp ndraws=1 as h is the same regardless? As e.g. within the draw loop if comp draws=5 (say)

disp hdraws(t)
0.00765 0.00000 0.00000 0.00000 0.00000
0.00765 0.00765 0.00000 0.00000 0.00000
0.00765 0.00765 0.00765 0.00000 0.00000
0.00765 0.00765 0.00765 0.00765 0.00000
0.00765 0.00765 0.00765 0.00765 0.00765
For one step forecasts, you don't need to do any draws at all (which I said right off). But if you are doing multi-step forecasts anyway, it only complicates the programming to treat the 1 step any differently.

ac_1 wrote: 4) Multistep head forecasts

As with SKIPSAVE in FORECAST or

compute rhat12(regend+12)=rhat(regend+12)

How do I gather the nth step ahead multistep forecast within the t1 loop?

Code: Select all

*===============================
compute ndraws=10000
compute nsteps=50


*===============================
infobox(action=define,lower=0,upper=(iend-ibegin),progress) "egarchbootstrap Model Backtest"

do t1 = 0, (iend-ibegin)
   *
   garch(p=1,q=1,exp,asymmetric,hseries=h,noprint,METHOD=BFGS) istart+t1 ibegin+t1 dlogdm
   *
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=BHHH) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=SIMPLEX) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=GENETIC) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=ANNEALING) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=GA) istart+t1 ibegin+t1 dlogdm
   if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,METHOD=EVALUATE) istart+t1 ibegin+t1 dlogdm
   *
   if (%converged == 0); disp 'Fail'
   *
   compute c=%beta(2),a=%beta(3),b=%beta(4),d=%beta(5)
   compute gstart=istart+t1,gend=ibegin+t1
   *
   set stdu = %resids/sqrt(h)
   *
   compute bstart=gend+1,bend=gend+nsteps
   set h bstart bend = %na
   *
   gset hdraws bstart bend = %zeros(ndraws,1)
   *
   * Compute the one-step bootstrap forecast for the variance
   *
   do draw=1,ndraws
      boot entries bstart bend gstart gend
      *
      set stdu bstart bend = h=sqrt(exp(c+b*log(h{1})+a*abs(stdu{1})+d*%max(stdu{1},0.0))),stdu(entries(t))
      do t=bstart,bend
         compute hdraws(t)(draw)=h(t)
      end do t
   end do draw
   *
   infobox(current=t1) "Model converged "+%converged
end do t1
infobox(action=remove)
Isn't that what is covered in the User's Guide? SKIPSAVE is an option only for FORECAST, but the first method works regardless.

BTW, your menu of estimation techniques is a really bad idea. Each one of those is being done from scratch, which is a massive waste of time. The GARCHBACKTEST.RPF example feeds in the overall sample estimates, which should start things off much better than the standard guess values. If that doesn't converge, then

if (%converged == 0); garch(p=1,q=1,exp,asymmetric,hseries=h,print,method=simplex,INITIAL=%BETA) istart+t1 ibegin+t1 dlogdm

(Note the INITIAL=%BETA option)

should be enough. The others (other than METHOD=EVALUATE) are long-shots for hard to fit (typically multi-modal) models. An EGARCH isn't one of them.

METHOD=EVALUATE should only be used with an INITIAL option. Otherwise, all you are doing is evaluating at the standard guess values.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

Thanks.

(1) Using Julian dates, multi-step ahead forecasts for GARCH(1,1), the 1st TOOS forecast date repeats

2020:07:03
2020:07:06 end of sample
2020:07:06 1st TOOS forecast: 1 step ahead forecast, but the is DATE is REPEATED
2020:07:07 2nd TOOS forecast: multi-step ahead forecast
2020:07:08 3rd TOOS forecast: multi-step ahead forecast
etc

How to extend the dates, so 2020:07:06 is not repeated?


(2) For GARCH(1,1) with generalized error distribution
(i) 1% VaR is: comp VaR = %invged(.99,%shape) * sigma * value [correct?]
(ii) What is the calculation for 1% ES in RATS?


(3) Multi-step ahead forecasts for GARCH(1,1) is anchored on the 1 step ahead forecast, iterated forward at each step ahead.

There is no closed form solution for egarch forecasting.

Based on the bootstrapped 1 step ahead egarchbacktest (t1 loop), if I increase nsteps=3, and ndraws=10 (say),

ITER 0
draws
1501 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765
1502 0.01517 0.01765 0.01708 0.01957 0.01583 0.01854 0.01510 0.01551 0.01504 0.01731
1503 0.01623 0.01944 0.01757 0.02009 0.01774 0.01723 0.01705 0.01747 0.01937 0.03072

ITER 1
draws
1501 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765
1502 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782
1503 0.01618 0.01511 0.01620 0.01940 0.01712 0.01785 0.01551 0.01485 0.01556 0.01604
1504 0.02007 0.01622 0.01835 0.01665 0.01945 0.01968 0.01654 0.01611 0.01666 0.01997

ITER 2
draws
1501 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765
1502 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782
1503 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783
1504 0.01475 0.01468 0.01605 0.01509 0.01609 0.01549 0.01524 0.01483 0.01490 0.01543
1505 0.02013 0.01788 0.01733 0.01718 0.01891 0.01641 0.01627 0.01649 0.01620 0.01935

how to save EACH nth step forecasts (lower, upper, median, mean) as series, presumably in?

Code: Select all

set lower ibegin+1 iend+1 = %fractiles(hdraws(t),||.05||)(1)
set upper ibegin+1 iend+1 = %fractiles(hdraws(t),||.95||)(1)
set median ibegin+1 iend+1 = %fractiles(hdraws(t),||.50||)(1)
set mean ibegin+1 iend+1 = %avg(hdraws(t))
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote:Thanks.

(1) Using Julian dates, multi-step ahead forecasts for GARCH(1,1), the 1st TOOS forecast date repeats

2020:07:03
2020:07:06 end of sample
2020:07:06 1st TOOS forecast: 1 step ahead forecast, but the is DATE is REPEATED
2020:07:07 2nd TOOS forecast: multi-step ahead forecast
2020:07:08 3rd TOOS forecast: multi-step ahead forecast
etc

How to extend the dates, so 2020:07:06 is not repeated?
By extending the series you input in the JULIAN option on CALENDAR.
ac_1 wrote: (2) For GARCH(1,1) with generalized error distribution
(i) 1% VaR is: comp VaR = %invged(.99,%shape) * sigma * value [correct?]
(ii) What is the calculation for 1% ES in RATS?
(i) Yes.
(ii) I don't know if the GED has closed form conditional expectations.

Re (1). While the two are identical (in this case), it's actually -%invged(.01,%shape) rather than +%invged(.99,%shape)
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote:(3) Multi-step ahead forecasts for GARCH(1,1) is anchored on the 1 step ahead forecast, iterated forward at each step ahead.

There is no closed form solution for egarch forecasting.

Based on the bootstrapped 1 step ahead egarchbacktest (t1 loop), if I increase nsteps=3, and ndraws=10 (say),

ITER 0
draws
1501 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765
1502 0.01517 0.01765 0.01708 0.01957 0.01583 0.01854 0.01510 0.01551 0.01504 0.01731
1503 0.01623 0.01944 0.01757 0.02009 0.01774 0.01723 0.01705 0.01747 0.01937 0.03072

ITER 1
draws
1501 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765
1502 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782
1503 0.01618 0.01511 0.01620 0.01940 0.01712 0.01785 0.01551 0.01485 0.01556 0.01604
1504 0.02007 0.01622 0.01835 0.01665 0.01945 0.01968 0.01654 0.01611 0.01666 0.01997

ITER 2
draws
1501 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765 0.00765
1502 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782 0.00782
1503 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783 0.00783
1504 0.01475 0.01468 0.01605 0.01509 0.01609 0.01549 0.01524 0.01483 0.01490 0.01543
1505 0.02013 0.01788 0.01733 0.01718 0.01891 0.01641 0.01627 0.01649 0.01620 0.01935

how to save EACH nth step forecasts (lower, upper, median, mean) as series, presumably in?

Code: Select all

set lower ibegin+1 iend+1 = %fractiles(hdraws(t),||.05||)(1)
set upper ibegin+1 iend+1 = %fractiles(hdraws(t),||.95||)(1)
set median ibegin+1 iend+1 = %fractiles(hdraws(t),||.50||)(1)
set mean ibegin+1 iend+1 = %avg(hdraws(t))
The bookkeeping that you need would be completely different. That's designed to do each of a large number of steps ahead at a base time. You want a more modest number of steps ahead at a number of different bases. Your end result probably would be best set up as a SERIES of VECTORS for each of the statistics that you want. (You actually don't need the lower and upper for anything, and you should probably only do one of mean or median).

You would benefit a great deal from learning to do pseudo-coding:

https://www.estima.com/ratshelp/pseudocode.html

Your first try almost always has the logic completely wrong.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

TomDoan wrote:
ac_1 wrote:
ac_1 wrote: (2) For GARCH(1,1) with generalized error distribution
(i) 1% VaR is: comp VaR = %invged(.99,%shape) * sigma * value [correct?]
(ii) What is the calculation for 1% ES in RATS?
(i) Yes.
(ii) I don't know if the GED has closed form conditional expectations.
GED is not listed here https://en.wikipedia.org/wiki/Expected_shortfall hence from the ES definition, it would be

ES = -(1/.99) * integral from 0 to .99 ( %invged(.99,%shape) * sigma * value )

If so, how to integrate the VaR in RATS?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

Actually, that isn't correct. You have the wrong "alpha" and the wrong integral.

ITOT that the GED does have a computable conditional expectation; it's just ugly. (Ratio of a couple of incomplete gammas).

You can use %ISIMPSON or %ITRAPEZOID to do a numerical integral. Note that the sigma*value can be factored out of the integral, so you only have to integrate the %invged function itself.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

TomDoan wrote:Actually, that isn't correct. You have the wrong "alpha" and the wrong integral.

ITOT that the GED does have a computable conditional expectation; it's just ugly. (Ratio of a couple of incomplete gammas).

You can use %ISIMPSON or %ITRAPEZOID to do a numerical integral. Note that the sigma*value can be factored out of the integral, so you only have to integrate the %invged function itself.
What does ITOT mean? I would much rather prefer the analytical solution (and how to translate into RATS): where is equation with the Ratio of a couple of incomplete gammas on the Wikipedia page?

Numerically, sorry, I cannot calculate the numerical integral, I get an error (what does Argument type: VECTORs (should be same dimension) mean)?

Just for 1 estimation:

comp shape = 1.36737
comp sigma = 0.01298
comp value = 100.0

@gridseries(from=0.0,to=.99,size=.001,pts=gpts) xgrid
make points
# xgrid

comp numint = %itrapezoid(points,%invged(.99,shape))

## MAT2. Matrices with Dimensions 991 x 1 and 1 x 1 Involved in Left out of table Operation

comp ES = -(1/.99) * sigma * value * numint
disp ES

Also, is it fair to say intuitively ES should not be too dissimilar from using a Student-t distribution in GARCH(1,1)? And if it's not?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ITOT = It Turns Out That

Integrals of the GED (at least integrals with entirely negative range or entirely positive range) can be handled by a transformation replacing u=x^p. That will transform it into the form of a gamma function integral. Over partial ranges that will be an incomplete gamma which can be computed in RATS with %gammainc(x,a) where x is the value and a is the shape. If you can find someone who has worked that out, you can use that. I have no intention of doing it myself.

With both %ITRAPEZOID and %ISIMPSON (Simpson's rule is more accurate), you need to feed in two identically sized VECTORS (which it says rather clearly in the documentation), the first of which has the grid points, the second the corresponding function values. Once you've set the grid points, you can use EWISE to fill in the corresponding function values.

However, I would again note that your understanding of the integral needed is wrong (very wrong). alpha is NOT .99. I assume you want .01---this is a left tail event. And you integrate %INVGED(x,%shape) not %INVGED(.99,%shape)---the latter is a constant.

The VaR for a t is higher than the VaR for a Normal with the same variance because it has thicker tails. The ES is higher than the VaR for the corresponding distribution because it looks at the probabilities of more extreme values than the specified level. So they're both higher than the VaR for a Normal. But they are not, and aren't intended to be, substitutes.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

In GED GARCH I calculated the numerical integral using %ISIMPSON. I had to change the lower limit to >0 in compute xx=%seqrange(1e-15,0.01,101) as that resulted in a NA.


Based on egarchbootstrap and garchbacktest, I calculated bootstrapped EGARCH multi-period nth-step ahead forecasts as:

set fres_1 1501+t1 1501+t1 = %avg(hdraws(t))
set fres_2 1502+t1 1502+t1 = %avg(hdraws(t))
etc, etc
set fres_5 1505+t1 1505+t1 = %avg(hdraws(t))

( or I can dec vect[series] forc(5), and store as a series of vectors), after the draw loop --- is that the correct method? --- having multiplied the log returns by 100 due to convergence & scaling.

A-priori I'd expect some downsizing with the forecast horizon. Plotting e.g. the 5th-step (nth-step) ahead EGARCH forecasts they "diminish" in comparison to the 1 or 2-steps ahead, which is odd as in a non-bootstrapped GARCH the 5-steps ahead 'more or less' lag the 1-step. Although in egarchbootstrap.rpf, the 50-step ahead forecasts are very-flat.

Is the EGARCH theoretical unconditional LR variance: sigmasq = exp( C / (1 - B) )? The point being does EGARCH converge to the unconditional LR variance much quicker than a GARCH(1,1)?


The GJR-GARCH formulae for a bootstrap is:

set stdu bstart bend = h=sqrt(c + b*(h{1}) + a*(stdu{1}) + d*%if(stdu{1}<0.0,1.0,0.0) ), stdu(entries(t))

Is there a closed-form solution for sigma in a GJR-GARCH?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote:In GED GARCH I calculated the numerical integral using %ISIMPSON. I had to change the lower limit to >0 in compute xx=%seqrange(1e-15,0.01,101) as that resulted in a NA.
Yes, the VaR (for any distribution which has support on the full real line) will go to infinity as alpha->0, but slowly enough that it can integrate.
ac_1 wrote: Based on egarchbootstrap and garchbacktest, I calculated bootstrapped EGARCH multi-period nth-step ahead forecasts as:

set fres_1 1501+t1 1501+t1 = %avg(hdraws(t))
set fres_2 1502+t1 1502+t1 = %avg(hdraws(t))
etc, etc
set fres_5 1505+t1 1505+t1 = %avg(hdraws(t))

( or I can dec vect[series] forc(5), and store as a series of vectors), after the draw loop --- is that the correct method? --- having multiplied the log returns by 100 due to convergence & scaling.

A-priori I'd expect some downsizing with the forecast horizon. Plotting e.g. the 5th-step (nth-step) ahead EGARCH forecasts they "diminish" in comparison to the 1 or 2-steps ahead, which is odd as in a non-bootstrapped GARCH the 5-steps ahead 'more or less' lag the 1-step. Although in egarchbootstrap.rpf, the 50-step ahead forecasts are very-flat.
The forecasts should converge to the stationary value. If the B coefficient in an EGARCH is near one, that will be a fairly slow process. If you start out below the stationary value, they will go up; if you start out above, they will go down.
ac_1 wrote: Is the EGARCH theoretical unconditional LR variance: sigmasq = exp( C / (1 - B) )? The point being does EGARCH converge to the unconditional LR variance much quicker than a GARCH(1,1)?
The persistence on a GJR GARCH model is A+B+.5*D. It might be a bit higher than what you get on an EGARCH, but both will likely be in the mid .9x's on most typical series.
ac_1 wrote: The GJR-GARCH formulae for a bootstrap is:

set stdu bstart bend = h=sqrt(c + b*(h{1}) + a*(stdu{1}) + d*%if(stdu{1}<0.0,1.0,0.0) ), stdu(entries(t))

Is there a closed-form solution for sigma in a GJR-GARCH?
The out-of-sample expectation for the variance (not the standard deviation) of the asymmetry term is .5*d*h(t-1). And your formula is wrong---the recursion is in the variance not the standard deviation and it doesn't use standardized u's; it uses u^2.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: UV garch model forecasts

Unread post by ac_1 »

Thanks.

To verify: the GJR and EGARCH both have to be bootstrapped even though from the definition's the one-step ahead forecast is known today?

Is this correct for one-step ahead bootstrap GJR?

Code: Select all

compute c=%beta(2),a=%beta(3),b=%beta(4),d=%beta(5)
compute gstart=istart+t1,gend=ibegin+t1
*
set u = %resids^2
*
compute bstart=gend+1,bend=gend+nsteps
set h bstart bend = %na
*
gset hdraws bstart bend = %zeros(ndraws,1)
 *
 * Compute the one-step bootstrap forecast for the variance
 *
   do draw=1,ndraws
      boot entries bstart bend gstart gend
      *
      set u bstart bend = h=( c + b*(h{1}) + a*(u{1}) + d*%if(u{1}<0.0,1.0,0.0) ),u(entries(t))
      do t=bstart,bend
         compute hdraws(t)(draw)=h(t)
      end do t
   end do draw
A general point with regards to GARCH models: on occasion there are NA's in a backtest for sigma, VaR and ES despite convergence, why may this happen and how do I handle these?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: UV garch model forecasts

Unread post by TomDoan »

ac_1 wrote:Thanks.

To verify: the GJR and EGARCH both have to be bootstrapped even though from the definition's the one-step ahead forecast is known today?
Absolutely not. The forecasts for GJR can be generated recursively. You asked about that, and I answered. (The asymmetry term has a .5 weight in the variance recursion).
ac_1 wrote: Is this correct for one-step ahead bootstrap GJR?

Code: Select all

compute c=%beta(2),a=%beta(3),b=%beta(4),d=%beta(5)
compute gstart=istart+t1,gend=ibegin+t1
*
set u = %resids^2
*
compute bstart=gend+1,bend=gend+nsteps
set h bstart bend = %na
*
gset hdraws bstart bend = %zeros(ndraws,1)
 *
 * Compute the one-step bootstrap forecast for the variance
 *
   do draw=1,ndraws
      boot entries bstart bend gstart gend
      *
      set u bstart bend = h=( c + b*(h{1}) + a*(u{1}) + d*%if(u{1}<0.0,1.0,0.0) ),u(entries(t))
      do t=bstart,bend
         compute hdraws(t)(draw)=h(t)
      end do t
   end do draw
No. You can't square the residuals right off the bat, since then you've lost the sign information. And you need to standardize the u's, bootstrap the standardized u's, then scale them up by the standard deviation to get the draw for u. (The last step isn't necessary in the EGARCH because it only uses the residuals in standardized form). And your asymmetry term in your SET is just either D or 0, with no reference to the size of the residual.
ac_1 wrote: A general point with regards to GARCH models: on occasion there are NA's in a backtest for sigma, VaR and ES despite convergence, why may this happen and how do I handle these?
You shouldn't if you've done things correctly.
Post Reply