Page 1 of 1

Eviews 9 - convergence problems

Posted: Wed Apr 29, 2015 11:33 am
by lfpazevedo
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
'==================================

Re: Eviews 9 - convergence problems

Posted: Wed Apr 29, 2015 4:40 pm
by EViews Glenn
We're testing a fix for this. Stay tuned.

[Edit: a fix is available in today's patch].

Re: Eviews 9 - convergence problems

Posted: Mon May 04, 2015 7:53 am
by lfpazevedo
The problem was not solve.
Try this code. It is working well on Eviews 6, but not on Eviews 9

wfcreate m 2005M01 2015M12
rndseed 1

smpl @first+25 @last
series e = nrnd
series x1 = 100*rnd
series x2 = 30*nrnd
series x3 = -4*rnd
group xs x1 x2 x3

smpl @first+25 @last-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(16,!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(-1) + [AR(1)=C(4)] + C(11) + C(12)*@SEAS(1) + C(13)*@SEAS(2) + C(14)*@SEAS(3) + C(15)*@SEAS(4) + C(16)*@SEAS(5) + C(17)*@SEAS(6) + C(18)*@SEAS(7) + C(19)*@SEAS(8) + C(20)*@SEAS(9) + C(21)*@SEAS(10) + C(22)*@SEAS(11)

' 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(-1) + [AR(1)=C(4)] + C(11) + C(12)*@SEAS(1) + C(13)*@SEAS(2) + C(14)*@SEAS(3) + C(15)*@SEAS(4) + C(16)*@SEAS(5) + C(17)*@SEAS(6) + C(18)*@SEAS(7) + C(19)*@SEAS(8) + C(20)*@SEAS(9) + C(21)*@SEAS(10) + C(22)*@SEAS(11)
eq01.fit(f=actual) yf2

d(noerr) ser

series yf3 = y

smpl @last @last
series yf3 = yf2

smpl @all

Re: Eviews 9 - convergence problems

Posted: Mon May 04, 2015 8:15 am
by startz
edit to delete unhelpful advice

Re: Eviews 9 - convergence problems

Posted: Mon May 04, 2015 9:49 am
by EViews Glenn
The previous bug was fixed. What you are reporting now is a different issue than the previous post.

What's going on now is that the syntax parser is no longer handling the "[ar(1)=c(4)] in the middle of the expression. I'll work on tracing down the change and getting a fix. For now, if you move that part of the expression to the end of the line, your program will run to completion.

Re: Eviews 9 - convergence problems

Posted: Mon May 04, 2015 10:12 am
by EViews Glenn
Sorry, that one was me. The earlier fix caused problems when you had, as in the example, an explicit AR regression with the AR portion of the specification in the middle of the expression. That one wasn't in my set of tests.

As I said, for now, if you put the AR portion at the end of the spec, you'll be fine. You'll find a fix in the next patch. Sorry for the inconvenience.

Re: Eviews 9 - convergence problems

Posted: Mon May 04, 2015 10:15 am
by lfpazevedo
Thanks!
It is working now.