Statalist


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

Re: st: adjusted R2 in survey regression


From   Steven Samuels <[email protected]>
To   [email protected]
Subject   Re: st: adjusted R2 in survey regression
Date   Wed, 15 Oct 2008 11:11:35 -0400

Below is a do-file which will calculate the adjusted R-square and related statistics after -svy: reg-. The statistics are computed as temporary variables and are displayed with Nick Cox's -dlist- command, downloadable from SSC. Be sure to zap gremlins in your text editor before running the code. I agree with Maarten that theory- based choice of predictors is a necessity.

-Steve

**************************CODE BEGINS**************************
/* Program to Compute Adjusted R Square for -svy: reg- */
capture program drop _all

webuse nhanes2, clear
svy : reg weight height
predict double resid, residual

svy: mean weight resid // substitute the response variable for "weight" here"
tempvar v1 v2 sd1 sd2 adjr2

gen `v1' = e(N)*el(e(V_srs),1,1)
gen `sd1' = sqrt(`v1')
gen `v2' = e(N)*el(e(V_srs),2,2)
gen `sd2' = sqrt(`v2')
gen `adjr2'= 100* (1-`v2'/`v1')

label var `v1' "Est Pop Variance"
label var `v2' "Est Residual Var"
label var `sd1' "Est Pop SD"
label var `sd2' "Est Resid SD"
label var `adjr2' "Adjusted R-Sq (%)"

format `v1' `v2' `sd1' `sd2' `adjr2' %10.1f

dlist `v1' `v2' `sd1' `sd2' `adjr2' in 1, name(0) // -dlist- by Nick Cox from SSC
***************************CODE ENDS***************************



On Oct 15, 2008, at 4:35 AM, Maarten buis wrote:

--- "Aca N.T." <[email protected]> wrote:
I'm puzzled with model building using -svy: reg- for there is no
adjusted R squared produced.
Is there an alternative test for this?

Yes, it's called theory. Add the variable in whose effect you are
interested and add variables you think influence both the variable of
interest and the dependent variable. Do _not_ add variables that are
influenced by the variable of interest and in turn influence the
dependent variable. In other words add confounding variables but not
intervening variables.

-- Maarten


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index