Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Fernando Rios Avila <f.rios.a@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: R2 and Xtreg vs areg |
Date | Fri, 2 Mar 2012 13:15:00 -0500 |
Dear Statalisters, I got an issue working with panel data fixed effects vs OLS including dummies. Basically, Im trying to compare the goodness of fit of some models, but i just realize that using xtreg vs areg give me different R2s. Is there any reason explaining this kind of difference? As an example compare this two models: In the areg output we have an R2 of 0.69, in the xtreg model is only 0.26. webuse nlswork xtset idcode xtreg ln_w grade age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure c.tenure#c.tenure 2.race not_smsa south, fe note: grade omitted because of collinearity note: 2.race omitted because of collinearity Fixed-effects (within) regression Number of obs = 28091 Group variable: idcode Number of groups = 4697 R-sq: within = 0.1727 Obs per group: min = 1 between = 0.3505 avg = 6.0 overall = 0.2625 max = 15 F(8,23386) = 610.12 corr(u_i, Xb) = 0.1936 Prob > F = 0.0000 ------------------------------------------------------------------------------------- ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] --------------------+---------------------------------------------------------------- grade | 0 (omitted) age | .0359987 .0033864 10.63 0.000 .0293611 .0426362 | c.age#c.age | -.000723 .0000533 -13.58 0.000 -.0008274 -.0006186 | ttl_exp | .0334668 .0029653 11.29 0.000 .0276545 .039279 | c.ttl_exp#c.ttl_exp | .0002163 .0001277 1.69 0.090 -.0000341 .0004666 | tenure | .0357539 .0018487 19.34 0.000 .0321303 .0393775 | c.tenure#c.tenure | -.0019701 .000125 -15.76 0.000 -.0022151 -.0017251 | 2.race | 0 (omitted) not_smsa | -.0890108 .0095316 -9.34 0.000 -.1076933 -.0703282 south | -.0606309 .0109319 -5.55 0.000 -.0820582 -.0392036 _cons | 1.03732 .0485546 21.36 0.000 .9421496 1.13249 --------------------+---------------------------------------------------------------- sigma_u | .35562203 sigma_e | .29068923 rho | .59946283 (fraction of variance due to u_i) ------------------------------------------------------------------------------------- F test that all u_i=0: F(4696, 23386) = 6.65 Prob > F = 0.0000 areg ln_w grade age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure c.tenure#c.tenure 2.race not_smsa south, absorb(idcode) note: grade omitted because of collinearity note: 2.race omitted because of collinearity Linear regression, absorbing indicators Number of obs = 28091 F( 8, 23386) = 610.12 Prob > F = 0.0000 R-squared = 0.6919 Adj R-squared = 0.6299 Root MSE = 0.2907 ------------------------------------------------------------------------------------- ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] --------------------+---------------------------------------------------------------- grade | 0 (omitted) age | .0359987 .0033864 10.63 0.000 .0293611 .0426362 | c.age#c.age | -.000723 .0000533 -13.58 0.000 -.0008274 -.0006186 | ttl_exp | .0334668 .0029653 11.29 0.000 .0276545 .039279 | c.ttl_exp#c.ttl_exp | .0002163 .0001277 1.69 0.090 -.0000341 .0004666 | tenure | .0357539 .0018487 19.34 0.000 .0321303 .0393775 | c.tenure#c.tenure | -.0019701 .000125 -15.76 0.000 -.0022151 -.0017251 | 2.race | 0 (omitted) not_smsa | -.0890108 .0095316 -9.34 0.000 -.1076933 -.0703282 south | -.0606309 .0109319 -5.55 0.000 -.0820582 -.0392036 _cons | 1.03732 .0485546 21.36 0.000 .9421496 1.13249 --------------------+---------------------------------------------------------------- idcode | F(4696, 23386) = 6.653 0.000 (4697 categories) thanks * * 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/