Postby bebebe » Sun Jun 24, 2012 1:45 am
Hi all,
I am using eviews 5 and have written a code by modifying from the rolling regression code posted in this forum, for rolling GARCH (1,1) forecasts for next 20 steps, for example, for period 1, observations 1 to 500 are using in GARCH model estimation, and variance forecasted sample is 501 to 520, and period 2 is observations 2 to 501 for estimation, and variance forecast is from 502 to 521. However, the matrix which i obtained shows 521 values in total, which i suppose the 1st 500 are actuals, while 501-521 are forecasts. Code as below.
I would like to calculate the annualised variance for this 20 steps for each period, using formula sqrt(sum of last 20 values*252/20)? Any idea how can i do this?
Thanks in advance....
' set window size
!window = 500
' set step size
!step = 1
' get size of workfile
!length = @obsrange
' declare equation for estimation
equation eq1
'calculate number of rolls
!nrolls = @round((!length-!window)/!step)
'matrix to store coefficient estimates
matrix(782,!nrolls) coefmat ' where 782 is the number of observations
'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 @first+!i-1 @first+!i+!window-2
' estimate arch equation
eq1.arch audr c
smpl @first+!i+!window-1 @first+!i+!window-1+20 'set sample for forecast period
eq1.forecast audf1 aud_se aud_var
'store coefficients
colplace(coefmat,aud_var,!j)
next
show coefmat