Correct usage of the dofor instruction

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
PERRY
Posts: 11
Joined: Thu Mar 08, 2007 8:50 am

Correct usage of the dofor instruction

Unread post by PERRY »

I need to do a series of regressions by changing only one dependent variable at a time. I read the manual and I think the correct way to do it is by the dofor instruction:

Code: Select all

dofor money = SUMM1 SUMM2M SUMM2 SUMMZM SUMALL
SET y = GDP_N
SET z1 = TB
SET z2 = cpi
SET z3 = money

linreg(noprint) y /RESIDS
#constant z1 z2 z3

end dofor money
Is this the correct way to use the instruction dofor? By this I needed to run 5 regressions where money is substituted in each regression for the five monetary aggregates abobe.
PERRY
Posts: 11
Joined: Thu Mar 08, 2007 8:50 am

Re: Correct usage of the dofor instruction

Unread post by PERRY »

I just think I found it. I must use it as in:

Code: Select all

SET z3 = money{0}
So that it declares the series money. Hope it is okay.
moderator
Site Admin
Posts: 269
Joined: Thu Oct 19, 2006 4:33 pm

Re: Correct usage of the dofor instruction

Unread post by moderator »

Yes, that will work. The lag notation forces RATS to treat MONEY as a series in that context.

You could just do:

linreg(noprint) y /RESIDS
# constant z1 z2 money

But if you want the regression output labelled as "z3" instead of the name of the current DOFOR series, what you have is one way to accomplish that.
Post Reply