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

st: RE: Adding R-Squared to sw command output


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Adding R-Squared to sw command output
Date   Thu, 27 May 2004 16:02:25 +0100

Not volunteering for this, given my 
feelings about -stepwise-. I'd just
like to point to -allpossible- on 
SSC. The intent behind writing that was negative: 
to show how many models in a given 
situation were almost equally good. Nevertheless
it may prove of some use to you. 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Rena Jenkins
> Sent: 27 May 2004 15:54
> To: [email protected]
> Subject: st: Adding R-Squared to sw command output
> 
> 
> Is there a Stata programming guru out there who could help me 
> modify the sw command so that the R-squared of the model is 
> output at each stage? (I am just running a linear 
> regression.)  i.e. to print the value of e(r2) at each stage.
> 
> So that when you run something like
> sw regress y x1 x2 x3, pe(0.05)
> 
> Instead of
>                       begin with empty model
> p = 0.0032 <  0.0500  adding   x2
> p = 0.0153 <  0.0500  adding   x1
> p = 0.0424 <  0.0500  adding   x3
> 
> You get something like:
>                       begin with empty model
> p = 0.0032 <  0.0500  adding   x2, R-squared = 0.2018
> p = 0.0153 <  0.0500  adding   x1, R-squared = 0.2523
> p = 0.0424 <  0.0500  adding   x3, R-squared = 0.2852
> 
> I have had a go at making a copy of sw.ado (swr.ado, say) and
> trying just to run the copy with minimal alterations. I couldn't
> even do that, so I need some help here.
> 
> I'm hoping that this would be easy to do for someone more
> knowledgeable than I am.

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