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

st: RE: Block or hierarchical regression


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Block or hierarchical regression
Date   Tue, 1 Nov 2005 21:02:56 -0000

I doubt you're missing anything pre-existing. 

One reason for that, I guess, is that this 
puts a great deal of emphasis on one questionable 
figure of merit. 

Another reason is that you can knit your own. 

Here's one template. 

sysuse auto, clear 
tempname r2 
scalar `r2' = 0 

local blocks `" "headroom weight"  "turn gear price" "rep78 trunk" "' 
local blocks `" `blocks' "length displacement foreign" "' 

foreach x of local blocks { 
	local X "`X' `x'" 
	qui regress mpg `X' 
	di as txt "`x'{col 30}" _c 
	di as txt "R-sq " as res %6.4f  e(r2) _c
	di as txt " Change " as res %6.4f e(r2) - `r2' 
	scalar `r2' = e(r2) 
}

headroom weight              R-sq 0.6523 Change 0.6523
turn gear price              R-sq 0.6599 Change 0.0077
rep78 trunk                  R-sq 0.6690 Change 0.0091
length displacement foreign  R-sq 0.7155 Change 0.0466

Nick 
[email protected] 

Garrard, Wendy M.

> I need to do a regression using blocks of predictors, and report the
> change in R^2 with the addition of each block.  I can't identify a
> regression command for doing this using the obvious keyword 
> searches of
> help files or the manual.  Is there a standard command that I am
> overlooking?  Or is there a user-written program for this?

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