Page 1 of 1

OLS with Variable Independent Variables

Posted: Wed Mar 16, 2011 3:50 am
by Jun
When I tried to run the following OLS procedure, I got the error message "%CURRENTSERIES(0 TO -12) is not a valid string or scalar name."
And when I place the "(0 TO -12)" outside the braces i.e. {%currentseries}(0 to -12), I get the error message "0TO is not defined." The message is "0TO" and not "0 TO -12" so I guess the brackets () are not read by the program.

Basically I'm trying to regress {%independent} on {%currentseries} with up to 12 lags.
Anyway around this or do I have to create another group for the lags first?


%independent=@wlookup("d?_*","series")

for !i=1 to @wcount(%independent)

%currentindependent=@word(%independent,!i)
%currentseries=@wlookup(%currentindependent,"series")
equation eq{!i}.ls(cov=hac) {%dependent} c {%currentseries(0 to -12)}

next

Re: OLS with Variable Independent Variables

Posted: Wed Mar 16, 2011 7:54 am
by EViews Gareth

Code: Select all

equation eq{!i}.ls(cov=hac) {%dependent} c {%currentseries}(0 to -12)

And to check it works, run this:

Code: Select all

create u 100 series y=nrnd series x=nrnd %dependent = "y" %currentseries = "x" equation eq.ls(cov=hac) {%dependent} c {%currentseries}(0 to -12)

Re: OLS with Variable Independent Variables

Posted: Wed Mar 16, 2011 4:57 pm
by Jun
Hi Gareth,

Can you explain why the following works? I don't get it.

%dependent = "y"
%currentseries = "x"

So now this works...BUT what should I do if I want to see the names of my independent variables in each "eq" output? Now they're all X's.

for !i=1 to @wcount(%independent)

%currentindependent=@word(%independent,!i)
%currentseries=@wlookup(%currentindependent,"series")
series y = nrnd
series x = nrnd
%dependent = "y"
%currentseries = "x"
equation eq{!i}.ls(cov=hac) {%dependent} c {%currentseries}(0 to -12)

next

OLS with Variable Independent Variables

Posted: Wed Mar 16, 2011 5:05 pm
by EViews Gareth
I don't understand your question.

Re: OLS with Variable Independent Variables

Posted: Wed Mar 16, 2011 5:16 pm
by Jun
I think I got it...thanks


for !i=1 to @wcount(%independent)

%currentindependent=@word(%independent,!i)
%currentseries=@wlookup(%currentindependent,"series")
series y = {%dependent}
series x = {%currentseries}
%dependent = "y"
%currentseries = "x"
equation eq{!i}.ls(cov=hac) {%dependent} c {%currentseries}(0 to -12)

next