Is there any way to compute CROSS efficiently?

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

colin.Fu
Posts: 7
Joined: Wed Jun 04, 2014 6:38 pm

Is there any way to compute CROSS efficiently?

Postby colin.Fu » Wed Jun 04, 2014 7:06 pm

Hi everyone!

Now I have 500 some independ variables marked as: x1, x2, x3, ....
and one depend variable y.

I wanna know the lag and lead of each x correspond to y.

Since the number of varibles is too many, so I go for a programme like this:

Code: Select all

For !intI = 1 To 500 %varName = indepvarlist(!intI) group mySubGroup y {%varName} freeze(cross_{%varName}) mySubGroup.cross(12) Next
the "indepvarlist" is a series alpha which stores the var list, x1, x2, ..., x500

now I have three problems:


1. since there only 100 samples for each x, when I create a series alpha in workfile, the object can only store 100 x, not 500 x. so part of variables can not be included.

2. I try to create the series alpha in a new workfile. Ok, 500 x can be stored, but the program can not run, since it can not find the var "indepvarlist".

3. Is there better way to do this job? I do not want to invent the wheel again and again and again.


Thanks! best regards! :D

Colin.Fu

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

Re: Is there any way to compute CROSS efficiently?

Postby EViews Gareth » Wed Jun 04, 2014 7:18 pm

Use an SVECTOR rather than a series alpha.

SVECTORs do not have to be workfile length - they can be any length you want.

You can access an individual element of an SVECTOR through the svector(!i) syntax, which you can't always do with a series alpha.

colin.Fu
Posts: 7
Joined: Wed Jun 04, 2014 6:38 pm

Re: Is there any way to compute CROSS efficiently?

Postby colin.Fu » Wed Jun 04, 2014 7:23 pm

Use an SVECTOR rather than a series alpha.

SVECTORs do not have to be workfile length - they can be any length you want.

You can access an individual element of an SVECTOR through the svector(!i) syntax, which you can't always do with a series alpha.

Thanks, it works!

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

Re: Is there any way to compute CROSS efficiently?

Postby EViews Gareth » Wed Jun 04, 2014 7:25 pm

Of course if the variables are really called X1...X500 you don't need to use anything to store the names, just use:

Code: Select all

%varname = "x" + @str(!i)

colin.Fu
Posts: 7
Joined: Wed Jun 04, 2014 6:38 pm

Re: Is there any way to compute CROSS efficiently?

Postby colin.Fu » Wed Jun 04, 2014 7:33 pm

Of course if the variables are really called X1...X500 you don't need to use anything to store the names, just use:

Code: Select all

%varname = "x" + @str(!i)
got it! I have tried to do this in this way, since I am a rookie of eviews, I failed then.

Thanks! this way is much better!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests