OLS with Variable Independent Variables

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

Jun
Posts: 12
Joined: Tue Mar 15, 2011 7:06 pm

OLS with Variable Independent Variables

Postby Jun » Wed Mar 16, 2011 3:50 am

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

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

Re: OLS with Variable Independent Variables

Postby EViews Gareth » Wed Mar 16, 2011 7:54 am

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)

Jun
Posts: 12
Joined: Tue Mar 15, 2011 7:06 pm

Re: OLS with Variable Independent Variables

Postby Jun » Wed Mar 16, 2011 4:57 pm

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
Last edited by Jun on Wed Mar 16, 2011 5:07 pm, edited 1 time in total.

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

OLS with Variable Independent Variables

Postby EViews Gareth » Wed Mar 16, 2011 5:05 pm

I don't understand your question.

Jun
Posts: 12
Joined: Tue Mar 15, 2011 7:06 pm

Re: OLS with Variable Independent Variables

Postby Jun » Wed Mar 16, 2011 5:16 pm

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


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests