Out of sample GARCH for forecasting volatility

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

Econoforecast
Posts: 25
Joined: Sun Feb 19, 2017 1:25 pm

Out of sample GARCH for forecasting volatility

Postby Econoforecast » Thu Mar 16, 2017 8:53 am

I have tried various ways to do this, but perhaps I am missing something. This is more of me not being too familiar with the software, as I'm unsure which method will achieve my objectives, so any clarification appreciated.

I wish to forecast volatility of stock index returns using GARCH models. This entails firstly, estimating using GARCH models in-sample, and then doing an out of sample forecast to obtain the residuals/GARCH variance series, which I will then use in a forecast evaluation with actual volatility (proxy is squared returns in this case).

I wish to do recursive one step ahead forecasts whereby the coefficients are re-estimated and then stored, so that I can then make a GARCH variance series/extract the residuals and compare it with my squared returns.

1) My understanding is that from brief reading, the method "Anchoring at start" through the Advanced rolling regression add-in is what I need rather than than the "Fixed window" option. However, performing this command, or using the closely linked variation Object>roll, does not allow me to actually extract/store the residuals for Variance which I can use to do a forecast evaluation against my squared returns.

2) Conversely, could the static forecasting method also allow me to achieve this objective? As far as I know, this command through Proc>Forecast is one-step ahead but does not actually re-estimate the co-efficient. However, it does allow you to forecast out of sample and store the GARCH variance series, which you can then use to evaluate against squared returns.

Which method would allow me to achieve what I need? If anyone can clarify on this, it would be most appreciated.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Out of sample GARCH for forecasting volatility

Postby EViews Gareth » Thu Mar 16, 2017 9:48 am

Neither. You'll need to write your own script to do it.
Follow us on Twitter @IHSEViews

Econoforecast
Posts: 25
Joined: Sun Feb 19, 2017 1:25 pm

Re: Out of sample GARCH for forecasting volatility

Postby Econoforecast » Thu Mar 16, 2017 9:59 am

EViews Gareth wrote:Neither. You'll need to write your own script to do it.

I see. From using the Advanced rolling regression, and the Static forecasting command, the latter seems to be far more reliable to me than the former, which crashes a lot.

I have been told to have the static forecasting command as a backup in case I am unable to do what I detailed in my first post. Could you kindly clarify how the static forecasting command through Proc>Forecast works, i.e. which values is it using to generate the GARCH variance forecast?

Secondly, in terms of the script. I am not too conversant with this software, or programming/coding. Is there any code which has been written in the past, that would allow me to achieve my objective? Or alternatively one which I could tweak slightly?

Thanks.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Out of sample GARCH for forecasting volatility

Postby EViews Gareth » Thu Mar 16, 2017 10:16 am

Static forecast does what you want without the re-estimation. It uses the original estimated coefficients at every step.

viewtopic.php?f=15&t=878
Follow us on Twitter @IHSEViews

Econoforecast
Posts: 25
Joined: Sun Feb 19, 2017 1:25 pm

Re: Out of sample GARCH for forecasting volatility

Postby Econoforecast » Thu Mar 16, 2017 11:37 am

EViews Gareth wrote:Static forecast does what you want without the re-estimation. It uses the original estimated coefficients at every step.

viewtopic.php?f=15&t=878

Thanks.

What do you think of the following code from that thread? Is it clean enough and written well enough to fulfill my needs? I have no way of knowing as I have little programming experience. That said if its correct I could probably make sense of it and pass through my data. Just need some sort of confirmation whether it's written properly.

viewtopic.php?p=36922#p36922

Econoforecast
Posts: 25
Joined: Sun Feb 19, 2017 1:25 pm

Re: Out of sample GARCH for forecasting volatility

Postby Econoforecast » Fri Mar 17, 2017 3:19 pm

EViews Gareth wrote:Static forecast does what you want without the re-estimation. It uses the original estimated coefficients at every step.

viewtopic.php?f=15&t=878

I'm not sure what I'm doing wrong. Have used the code above but nothing happens when I press enter. I had already generated the GARCH equation and saved it. Tried modifying the code by entering my own sample dates and GARCH equation, but nothing happenned. To be frank, not sure what to modify, and what to leave out. Have provided the code I used, and the workfile containing the GARCH equation called "garcheqn". Original code I modified is also in up above post.

To be clear, my in-sample period is from 5/31/1996 to 6/01/2006, whilst my out of sample period runs from 6/02/2006 yo 6/01/2016

Any help and guidance much appreciated.

Code: Select all

!window = 20

!step = 1

!length = @obsrange

equation garcheqn

!nrolls = @floor((!length-!window)/!step)


series fcast

%start = "@first" '@otod(@ifirst(ser))   
%end = “@last“   '@otod(@ilast(ser))

!j=0

for !i = 1  to  !length-!window+1-!step step !step
   !j=!j+1
     
   %first = @otod(@dtoo(%start))
   %last = @otod(@dtoo(%start)+!i+!window-2)
   smpl {%first} {%last}     

   where the equation is GARCH = C(6) + C(7)*RESID(-1)^2 + C(8)*GARCH(-1)
   garcheqn.ARCH RT_ASX200 C AR(1) AR(2) MA(1) MA(2)
   

%1pers = @otod(@dtoo(%start)+!i+!window-1)
%1pere = @otod(@dtoo(%start)+!i+!window-1)

  if @dtoo(%end) < @dtoo(%1pere) then
      exitloop
   endif
   
   smpl {%1pers} {%1pere}   
   
   garcheqn.forecast(f=na) yf     

   smpl {%1pere} {%1pere} 
   
   fcast = yf
next

smpl @all
show fcast.line

d(noerr) yf
Attachments
Workfile recursive regression.zip
(1.64 MiB) Downloaded 296 times


Return to “Estimation”

Who is online

Users browsing this forum: Google [Bot] and 34 guests