generating interdependent series goes wrong

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

grabodan
Posts: 7
Joined: Thu Jun 11, 2015 6:36 am

generating interdependent series goes wrong

Postby grabodan » Fri Aug 14, 2015 6:30 am

Hi all,

I want to create three series that are dependent on each others past, as for simulating VAR-model or cointegrated data.
I have the following code:

Code: Select all

workfile u 1000

smpl @all
series common_root=0
series var1=0 'Just three variables var1, 2 and 3
series var2=0
series var3=0

smpl 2 @last
common_root=common_root(-1)+@nrnd
var1=var1(-1)-0.5*(var1(-1)-var2(-1)-var3(-1)) + common_root
var2=var2(-1) +0.25*(var1(-1)-var2(-1)-var3(-1))
var3=var3(-1) +0.25*(var1(-1)-var2(-1)-var3(-1))

Series 2 and 3 should be exactly the same. They should be computed at the same time, depending on each others past but not the contemporaneous values.
The Problem is, they (a) are quite different from each other (var2 sticks close to var1 while var3 sticks around the zero line) and (b) if I change the order of the code (switching the ordering of var2 and 3):

Code: Select all

var1=var1(-1)-0.5*(var1(-1)-var2(-1)-var3(-1)) + common_root
var3=var3(-1) +0.25*(var1(-1)-var2(-1)-var3(-1))
var3=var3(-1) +0.25*(var1(-1)-var2(-1)-var3(-1))

...the result changes (i.e. var3 now sticks around var1 and var2 sticks to the zero). Both things should not happen.
If I instead use a for loop such as below, it works as it should:

Code: Select all

smpl @all
series v1=0
series v2=0
series v3=0
for !t=2 to 1000
v1(!t)= v1(!t-1) - 0.5*( v1(!t-1) - v2(!t-1) - v3(!t-1) ) + common_root(!t)
v2(!t)= v2(!t-1) +0.25*( v1(!t-1) - v2(!t-1) - v3(!t-1) )
v3(!t)= v3(!t-1) +0.25*( v1(!t-1) - v2(!t-1) - v3(!t-1) )
next

I don't quite understand why that is but there has to be a problem with the way EViews computes the vectors / series (Does the program overlook the interdependency and computes the series one after the other?)

I have Version 8.1 Build Nov 11 2014.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: generating interdependent series goes wrong

Postby EViews Gareth » Fri Aug 14, 2015 7:45 am

I'm not quite sure what you expect to happen.

EViews programs are computed line by line.
Follow us on Twitter @IHSEViews

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: generating interdependent series goes wrong

Postby startz » Fri Aug 14, 2015 8:11 am

EViews computes all of var2 and then all of var3. That's why you're getting the difference.

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: generating interdependent series goes wrong

Postby EViews Glenn » Fri Aug 14, 2015 8:27 am

The model object may be used to evaluate the system of equations observation by observation.

grabodan
Posts: 7
Joined: Thu Jun 11, 2015 6:36 am

Re: generating interdependent series goes wrong

Postby grabodan » Mon Aug 17, 2015 4:30 am

EViews Gareth wrote:I'm not quite sure what you expect to happen.

EViews programs are computed line by line.


Hi,
thanks for the reply. Well I thought that EViews would automatically handle this. I mean, treating a vector as a series so that you dont need a for loop but only need to write y=alpha*y(-1) is a neat feature of EViews.
Because of that I expected that EViews always computes one point in time after the other, kind of an implicit for loop. And I expected to never need a loop for the creation of series ;)
Apparently that was naive.
Ok then. sorry for crying wolf :)

Btw I used to create vector series that way and never noticed my results are **** :roll:

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: generating interdependent series goes wrong

Postby EViews Glenn » Mon Aug 17, 2015 8:16 am

A bit of context...

The problem with always computing one point in time after the other is that EViews doesn't know when to start the evaluation. Suppose that you enter one series generation command and type return, should EViews generate all of the observations for that series, or wait for you to enter another command? And if it is going to wait, how long should it wait? Until the second, fifth, twentieth command? There is an implicit loop, but over the single series generation command; as Gareth says, line-by-line.

It is true that it is very useful to compute one point in time after another for a set of commands. EViews offers a specific object, the model object, for doing so. In this case you define an object with the set of commands you want to generate as a set, and tell EViews to solve the model an observation at a time. This creates your implicit loop over a set of commands. For your purposes, I think you'll find it useful.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 13 guests