Rolling forecasts for GARCH model

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Rstat
Posts: 1
Joined: Tue Nov 28, 2017 9:15 am

Rolling forecasts for GARCH model

Postby Rstat » Tue Nov 28, 2017 9:54 am

Hello guys. I am newbie in Eviews. I am stuck with an analysis. I searched all the forum and found some related topics about my problem. However, I could not manage to solve my problem.

My problem:

I have 964 return observations of a stock. By a windows size=200, I want to make rolling one a head forecasts for conditional variance using GARCH(1,1) model. And I also want to estimate the model coefficients at every 25 step.

For example,
- using observations from 1 to 200, first estimate the model coefficients, then using the estimated model, I want to forecast 201'th conditional variance,
- using observations from 1 to 200, first estimate the model coefficients, then using the estimated model, I want to forecast 202'th conditional variance,
......
- using observations from 26 to 225, first estimate the model coefficients, then using the estimated model, I want to forecast 226'th conditional variance,
......
-and so on.

I wrote such a code combining pieces from other topics. However, since I couldn't still gain the insight of the Eviews programming, I could not manage to solve the problem. My not working half code is as below:

Code: Select all

' set window size
!window = 200
 
' set step size
!step = 25
 
' get size of workfile
!length = 964

'calculate number of rolls
!nrolls = @round((!length-!window)/!step)



' declare equation for estimation
equation eq1

'matrix to store coefficient estimates
matrix(3,!nrolls)  coefmat ' where 3 is the number of coefficients

matrix(1,964) results

'variable keeping track of how many rolls we've done
!j=0

' move sample !step obs at a time
for !i = 1  to  !length-!window+1-!step step !step
   !j=!j+1

   ' set sample to estimation period
   smpl !i !i+!window-1

   ' estimate equation
  equation eq1.ARCH(1,1) returnx

eq1.forecast var


rowplace(results, garch_n@ARCH(1,1), !j)

'store coefficients
   colplace(coefmat,eq1.@coefs,!j)
next


I loaded the workfile as a attachment.

I will be very glad for any help. Thanks a lot.
Attachments
returnx.wf1
(23.41 KiB) Downloaded 227 times

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

Re: Rolling forecasts for GARCH model

Postby EViews Gareth » Tue Nov 28, 2017 10:05 am

You don't say what the issue is, but looking at the code, one thing jumps out.

When using the equation.forecast procedure, you have to provide a name for the forecast of the mean equation, the standard error, and then the conditional variance.
http://www.eviews.com/help/helpintro.ht ... 23ww176268
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 34 guests