Eviews 9 - convergence problems
Posted: Wed Apr 29, 2015 11:33 am
Hi.
The following program was working normally on Eviews 6 and 8, but not in Eviews 9.
With !obs=100 it works a few times.
But never with !obs=1000
'=====================================
!obs = 100
wfcreate u !obs
rndseed 1
smpl 25 !obs
series e = nrnd
series x1 = 100*rnd
series x2 = 30*nrnd
series x3 = -4*rnd
group xs x1 x2 x3
smpl 25 !obs-1
series y = 3 + 2*x1 + 4*x2 + 5*x3 + e
smpl @all
' set window size
!window = 35
' set step size
!step = 1
' get size of workfile
!length = @obsrange
' declare equation for estimation
equation eq01
'calculate number of rolls
!nrolls = @floor((!length-!window)/!step)
'matrix to store coefficient estimates
matrix(4,!nrolls) coefmat ' where 7 is the number of coefficients
'series to store forecast estimates
series eq01fcast
'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 = 25 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 y=c(1) + c(2)*x1 + c(3)*x2
eq01.ls y = c(1)*x1 + c(2)*x2 + c(3)*x3 + [AR(1)=C(18)]
' store coefficients
colplace(coefmat,eq01.@coefs,!j)
' 4-period-ahead forecast
%4pers = @otod(@dtoo(%start)+!i+!window-1) 'start point
%4pere = @otod(@dtoo(%start)+!i+!window-1) 'end point: %4pere - %4pers +1 = 1
if @dtoo(%end) < @dtoo(%4pere) then 'check whether the forecast end point is greater than the workfile end point
return
endif
' set smpl for forecasting period
smpl {%4pers} {%4pere}
' forecast with command *forecast* (see also *fit*)
eq01.fit(f=na) yf
' set sampl to obtain the 4th period observation
smpl {%4pere} {%4pere}
' store forecasts
eq01fcast = yf
next
'FORECAST IN-SAMPLE
smpl @all
eq01.ls y = c(1)*x1 + c(2)*x2 + c(3)*x3 + [AR(1)=C(18)]
eq01.fit(f=actual) yf2
d(noerr) ser
series yf3 = y
smpl !obs !obs
series yf3 = yf2
smpl @all
'==================================
The following program was working normally on Eviews 6 and 8, but not in Eviews 9.
With !obs=100 it works a few times.
But never with !obs=1000
'=====================================
!obs = 100
wfcreate u !obs
rndseed 1
smpl 25 !obs
series e = nrnd
series x1 = 100*rnd
series x2 = 30*nrnd
series x3 = -4*rnd
group xs x1 x2 x3
smpl 25 !obs-1
series y = 3 + 2*x1 + 4*x2 + 5*x3 + e
smpl @all
' set window size
!window = 35
' set step size
!step = 1
' get size of workfile
!length = @obsrange
' declare equation for estimation
equation eq01
'calculate number of rolls
!nrolls = @floor((!length-!window)/!step)
'matrix to store coefficient estimates
matrix(4,!nrolls) coefmat ' where 7 is the number of coefficients
'series to store forecast estimates
series eq01fcast
'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 = 25 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 y=c(1) + c(2)*x1 + c(3)*x2
eq01.ls y = c(1)*x1 + c(2)*x2 + c(3)*x3 + [AR(1)=C(18)]
' store coefficients
colplace(coefmat,eq01.@coefs,!j)
' 4-period-ahead forecast
%4pers = @otod(@dtoo(%start)+!i+!window-1) 'start point
%4pere = @otod(@dtoo(%start)+!i+!window-1) 'end point: %4pere - %4pers +1 = 1
if @dtoo(%end) < @dtoo(%4pere) then 'check whether the forecast end point is greater than the workfile end point
return
endif
' set smpl for forecasting period
smpl {%4pers} {%4pere}
' forecast with command *forecast* (see also *fit*)
eq01.fit(f=na) yf
' set sampl to obtain the 4th period observation
smpl {%4pere} {%4pere}
' store forecasts
eq01fcast = yf
next
'FORECAST IN-SAMPLE
smpl @all
eq01.ls y = c(1)*x1 + c(2)*x2 + c(3)*x3 + [AR(1)=C(18)]
eq01.fit(f=actual) yf2
d(noerr) ser
series yf3 = y
smpl !obs !obs
series yf3 = yf2
smpl @all
'==================================