Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Multi-stage OLS loop


From   "kelly johnson" <[email protected]>
To   [email protected]
Subject   st: Multi-stage OLS loop
Date   Mon, 25 Jul 2005 11:36:52 -0400

Hi,

I have a quick question abotu writing a loop for a multi-stage OLS regression.

Suppose I have data as follows:

Date Var1 Var2 ... var20 Var21

with about 1500 observations for each.

How can I can i write a quick loop to do the following:

regress var 2-var20 on var1, individually

(ie. reg Var1 Var2
reg Var1 Var2....
reg Var1 Var20)

and save the beta, r-square [e(r2)], and residuals.

In the second stage, I want to reress Var21 on the residuals from stage 1, saving the beta and r-square.

How can I make the out put be like this:

Var1 beta (from stage 1) r-square (from stage 1) beta (from stage 2) r-square (from stage 2)
...
Var20 beta (from stage 1) r-square (from stage 1) beta (from stage 2) r-square (from stage 2)

Thanks!

fuaad

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index