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

st: RE: Extracting B coefs and p's from "foreach" regression


From   "VISINTAINER PAUL" <[email protected]>
To   <[email protected]>
Subject   st: RE: Extracting B coefs and p's from "foreach" regression
Date   Wed, 24 Nov 2004 11:38:44 -0500

You might try something like the following.  I use it to output a table
comprising results from several t-tests.  (Use -return list- to identify
the which factors are available for use after your regression.)

tempname out
postfile `out' <output variable names here> using outfile, replace
foreach var of varlist <variables to be analyzed {
   qui ttest `var', by(case)
   post `out' ("`var'") (r(mu_2)) (r(sd_2)) (r(N_2)) (r(mu_1)) (r(sd_1))
/*
          */ (r(N_1)) (r(p))
}
postclose `out'

use outfile, clear
qui {
  for var case sd1 control sd2: format X %6.2f
format p %4.3f
}
list, clean noobs

*At this point, I just copy the output to a Word document.

Hope this helps,

-pv

______________________________
Paul F. Visintainer, PhD
Professor and Program Director 
Health Quantitative Sciences
School of Public Health
New York Medical College 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Garrard,
Wendy M.
Sent: Tuesday, November 23, 2004 4:12 PM
To: [email protected]
Subject: st: Extracting B coefs and p's from "foreach" regression

Hi All,
As part of preliminary descriptive analysis I need to examine pairwise
correlations between the effect size and a large number of possible
covariates.  The tricky part is that I have discovered I need to examine
pairwise correlations which take into account a random effects
component.  I can do this by specifying bivariate random effect
regressions using a metaregW macro in a foreach command as below:

*****
 foreach var of varlist  VarGrp1_* VarGrp_2* VarGrp_3*   {
       metaregW EffectSize `var' [aw=weight] , model(ml) 
}
*****

But, this produces lots of extraneous output (R^2, Qs, 95%CIs, etc.)
since I only need the B1_coef and p-value from each run.

So, I am looking for a way to either capture the target values in a
table/list via a modification of the above command, or an alternative
method of creating a list of the B1_coefs and p's for this problem.

Any suggestions?

Much thanks,
Wendy

*
*   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/

*
*   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