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.

Correct usage of the dofor instruction

Postby PERRY » Thu Mar 15, 2012 7:26 pm

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 9:50 am

Re: Correct usage of the dofor instruction

Postby PERRY » Thu Mar 15, 2012 9:51 pm

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.
PERRY
 
Posts: 11
Joined: Thu Mar 08, 2007 9:50 am

Re: Correct usage of the dofor instruction

Postby moderator » Fri Mar 16, 2012 9:57 am

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.
moderator
Site Admin
 
Posts: 306
Joined: Thu Oct 19, 2006 4:33 pm


Return to Help With Programming

Who is online

Users browsing this forum: No registered users and 0 guests