I am trying to get into eviews and especially what it can do in forecasting. I am trying to run a forecast for a known series ( ICI, 755 observations will be used for the forecast, the remainder of the 1254 observations will be used to judge the model ). It's quite simple what I am trying to do. I looked through the manual and found some code. I found this code below and understand most the code but I can't even get it to run, let alone evaluate it's correctness ( luckily I have matlab so if something is off, I can compare it )
I am Trying to construct Construct 1,2,3,4,5 ahead point forecasts for the sample period. Hence at each time T (T = 755, 756, . . . , 1254) I want to an forecast ICIT+h|T (h = 1, 2, 3, 4, 5), then I wan to re-estimate the AR(3) model repeatedly every 25 observations, 'using a 'moving 'window approach with a sample length of 755 observations of the ICI ( implied correlations index )
Any suggestions ? Is trying to solve it in this way even good ?
I also get an error saying @ifirst is an illegal or reserved name.
Perhaps you can help me or did something similar before and can show how you programmed this into this software.
Code: Select all
'DATA is already in the series file which contains the ICI
'Program description
' I am Trying to contruct Construct one-, two-, three-, four and
'five-step ahead point forecasts for the sample period. Hence at each time T (T = 755, 756, . . . , 1254) I want to an forecast ICIT+h|T (h = 1, 2, 3, 4, 5), then I wan to re-estimate the AR(3) model repeatedly every 25 observations, 'using a 'moving 'window approach with a sample length of 755 observations of the ICI ( implied correlations index )
'Date last modified 12/03/12 03:25 am
'------------------------------------------------------------------------------------
' set window size
!window = 25
' set step size
!step = 1
' get size of workfile
!length = @obsrange
' declare equation for estimation
equation eq1
'calculate number of rolls
!nrolls = @floor((!length-!window)/!step)
'matrix to store coefficient estimates
matrix(4,!nrolls) coefmat ' where 4 is the number of coefficients
'series to store forecast estimates
series fcast
'redundant series for catching start and end points
series ser = 1
%start = @otod(@ifirst(ser))
%end = @otod(@ilast(ser))
'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 for estimation period
%first = @otod(@dtoo(%start)+!i-1)
%last = @otod(@dtoo(%start)+!i+!window-2)
smpl {%first} {%last}
' estimate equation - where the equation is AR(3) model
eq1.ls ICI c AR(1) AR(2) AR(3)
' store coefficients
colplace(coefmat,eq1.@coefs,!j)
' 5-period-ahead forecast
%5pers = @otod(@dtoo(%start)+!i+!window-1) 'start point
%5pere = @otod(@dtoo(%start)+!i+!window+2) 'end point: %5pere - %5pers +1 = 5
if {%end} < {%5pere} then 'check whether the forecast end point is greater than the workfile end point
return
endif
' set smpl for forecasting period
smpl {%5pers} {%5pere}
' forecast with command *forecast* (see also *fit*)
eq1.forecast(f=na) ICIf
' set sampl to obtain the 5th period observation
smpl {%5pere} {%5pere}
' store forecasts
fcast = ICIf
next
smpl @all
show coefmat
show fcast.line
d(noerr) ser