Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: how to index regressions inside a foreach loop in order to avoid writing over the estimates


From   hind lazrak <[email protected]>
To   [email protected]
Subject   st: how to index regressions inside a foreach loop in order to avoid writing over the estimates
Date   Thu, 13 Oct 2011 14:54:18 -0700

Hello

I am using Stata Version 10 on Windows Vista.
The analysis I am conducting is exploratory and involves a long list
of independent variables I am testing using simple linear regression.
In order to see which variables are "promising" I'd like to find a way
to store each model estimate and ideally figure out how to tabulate
only those that have a p-value<0.1.

The code I used is as follow

foreach var of varlist [list of 55 vars] {
qui reg y1 `var'   */ first set of regressions looking at Y1
eststo model1`var'

qui reg y2 `var'  */ second set of regressions looking at Y2
eststo model2`var'
}
estimates table model1`var' model`var', beta not

This code is not working because it overwrites all the estimates in
each regression and only keeps the last one. Also I did not figure out
how to only show those with p-val<0.1

I think I need to create another loop to index each regression or
maybe I need to store in a matrix...can anyone help me?

Thank you for your time!

Hind
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index