how to write forecast code?
Posted: Wed Aug 14, 2013 11:04 pm
Hi guys :D
I am doing rolling GARCH to forecast the conditional variance.
I have 2000 observations and the window is 1000, roll is 100.
And I will estimate 11 windows. they are 1 1000, 101 1100, 201 1200 and so on.
each window will forecast the following 100 observations.
But I am very very new to the programming. I can only write the code to estimate the rolling GARCH model
[' set window size
!window=1000
' set step size
!step=100
' get the size of workfile
!length=@obsrange
' calculate number of rolls
!nrolls = @round((!length-!window+!step)/!step)
' variable keeping track of how many rolls we've done
!j=0
for !i = 1 to !length-!window+1 step !step
!j=!j+1
' set sample of estimation period
smpl @first+!i-1 @first+!i+!window-2
' estimate equation
equation garch_n_{!j}
garch_n_{!j}.ARCH(1,1) return c
next][/code].
I don't know how to write the forecast code into the above code. Could anybody help me or give me some information about forecasting? :D :D :D :D :D
I am doing rolling GARCH to forecast the conditional variance.
I have 2000 observations and the window is 1000, roll is 100.
And I will estimate 11 windows. they are 1 1000, 101 1100, 201 1200 and so on.
each window will forecast the following 100 observations.
But I am very very new to the programming. I can only write the code to estimate the rolling GARCH model
[' set window size
!window=1000
' set step size
!step=100
' get the size of workfile
!length=@obsrange
' calculate number of rolls
!nrolls = @round((!length-!window+!step)/!step)
' variable keeping track of how many rolls we've done
!j=0
for !i = 1 to !length-!window+1 step !step
!j=!j+1
' set sample of estimation period
smpl @first+!i-1 @first+!i+!window-2
' estimate equation
equation garch_n_{!j}
garch_n_{!j}.ARCH(1,1) return c
next][/code].
I don't know how to write the forecast code into the above code. Could anybody help me or give me some information about forecasting? :D :D :D :D :D