Page 1 of 1

Is there any way to compute CROSS efficiently?

Posted: Wed Jun 04, 2014 7:06 pm
by colin.Fu
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

Re: Is there any way to compute CROSS efficiently?

Posted: Wed Jun 04, 2014 7:18 pm
by EViews Gareth
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.

Re: Is there any way to compute CROSS efficiently?

Posted: Wed Jun 04, 2014 7:23 pm
by colin.Fu
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!

Re: Is there any way to compute CROSS efficiently?

Posted: Wed Jun 04, 2014 7:25 pm
by EViews Gareth
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)

Re: Is there any way to compute CROSS efficiently?

Posted: Wed Jun 04, 2014 7:33 pm
by colin.Fu
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!