Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
hind lazrak <hindstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Thu, 13 Oct 2011 20:46:24 -0700 |

Dear Richard Thank you for taking the time to respond to the question I posted. I made the example simpler in my post for more clarity. In the first step I ran the pwcorr, sig to capture the list of variables that I ran in the loop. In fact the simple linear regression does include three other variables that may act as either modifier or confounder. So I need to control for them. So this brings me back to the original question. Is there any way to get a table of coeffs that are statistically significant at the 95% level? Many thanks, Hind On Thu, Oct 13, 2011 at 5:38 PM, Richard Williams <richardwilliams.ndu@gmail.com> wrote: > At 04:54 PM 10/13/2011, hind lazrak wrote: >> >> 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 > > The line > > estimates table model1`var' model`var', beta not > > should probably be > > estimates table model1`var' model2`var', beta not > > And, it should come before the }, not afterwards. > > This is just a bunch of bivariate regressions, right? Why not something like > > pwcorr y1 y2 x1-x55, star(.10) > > You could probably also fiddle around with the ereturned results and make > the estimates table command conditional on one p value or the other being > significant. > > ------------------------------------------- > Richard Williams, Notre Dame Dept of Sociology > OFFICE: (574)631-6668, (574)631-6463 > HOME: (574)289-5227 > EMAIL: Richard.A.Williams.5@ND.Edu > WWW: http://www.nd.edu/~rwilliam > > * > * 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/ > * * 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/

**Follow-Ups**:**Re: st: how to index regressions inside a foreach loop in order to avoid writing over the estimates***From:*Nick Cox <njcoxstata@gmail.com>

**References**:**st: how to index regressions inside a foreach loop in order to avoid writing over the estimates***From:*hind lazrak <hindstata@gmail.com>

**Re: st: how to index regressions inside a foreach loop in order to avoid writing over the estimates***From:*Richard Williams <richardwilliams.ndu@gmail.com>

- Prev by Date:
**st: multinomial multilevel analysis in Stata** - Next by Date:
**Re: st: multinomial multilevel analysis in Stata** - Previous by thread:
**Re: st: how to index regressions inside a foreach loop in order to avoid writing over the estimates** - Next by thread:
**Re: st: how to index regressions inside a foreach loop in order to avoid writing over the estimates** - Index(es):