Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: how to compute pseudo-r2 at cluster level using xtreg?
From
Clara Barata <[email protected]>
To
[email protected]
Subject
st: how to compute pseudo-r2 at cluster level using xtreg?
Date
Thu, 2 Sep 2010 12:48:29 -0400
Hi!
I was trying to figure out how to recreate the pseudo r2 values that
are outputed with xtreg with random effects . I basically computed
sigma_e squared and estimated the proportional decline in sigma_e
squared comparing each model with the unconditional model to get r2_w
(individual level) . I did the same for sigma_u to get r2_b (cluster
level). However, this formula only seems to work for r2_w but not for
the cluster level r2.
M1 M2 M3
N 933 933 933
Sigma_u 1.242 1.015 0.696
Sigma_e 5.048 3.335 3.339
Rho 0.057 0.085 0.042
R2-b 0.000 0.466 0.725
R2_w 0.000 0.564 0.564
Chi2 1196.634 1224.520
df 0 2 11
My computations indicate that r2_b for model 2 should be 0.33 and
should be 0.68 for model 3:
M1 M2 M3 Sigma2 M1 Sigma2 M2 Sigma2
M3 Pseudo-R2, M1 M2 Pseudo-R2, M1 M3
Sigma_u 1.242 1.015 0.696 1.542564 1.030225
0.484416 0.33213468 0.685967
Sigma_2 5.048 3.335 3.339 25.482304 11.122225
11.148921 0.563531422 0.562483793
Alternatively I also used xtmixed with random effects for the same
level of clustering and I get different variance estimates and a
different pseudo r2 at the cluster level from what I get using my
computations and xtreg.
M1 M2 M3
N 933 933 933
var_u1 1.578 0.671 0.203
var_e 25.467 11.144 11.127
rho1 0.058 0.057 0.018
-2LL -2849.348 -2463.522 -2454.328
df 0.0 2.0 11.0
AIC 5704.696 4937.044 4936.656
BIC 5719.212 4961.236 5004.393
Pseudo-R^2, L1 0.57 0.87
I appreciate any comments or suggestions,
Clara
ps- code for xtreg and xtmixed is below.
XTREG CODE:
xtset idcoleg1
xtreg w2p1, re
eststo model1
xtreg w2p1 interv1 w1p1, re
eststo model2
xtreg w2p1 interv1 w1p1 masculino rdmage mteacher_age mteachingless5
mteaching5to14 mPrivado mpostgrad com2 com3, re
eststo model3
esttab using withinschool1.rtf, cells(b(fmt(3) star) se(par fmt(3)))
noconstant ///
stats(N sigma_u sigma_e rho r2_b r2_w chi2 df_m pr2, ///
fmt(0 3 3 3 3 3 3 0) label(N SD-Cluster SD-Individual ICC R2-Between
R2-Within Chi-Squared df pr2)) ///
star(~ 0.10 * 0.05 ** 0.01 *** 0.001) replace
XTMIXED code:
xtmixed w2p1 || idcoleg1: , cov(un) mle var
xtmrho
eststo model1
xtmixed w2p1 interv1 w1p1 || idcoleg1: , cov(un) mle var
xtmrho
eststo model2
xtmixed w2p1 interv1 w1p1 masculino rdmage mteacher_age
mteachingless5 mteaching5to14 mPrivado mpostgrad com2 com3|| idcoleg1:
, cov(un) mle var
xtmrho
eststo model3
esttab using WJ__impacts.rtf, cells(b(fmt(3) star) se(par fmt(3)) ci)
noconstant ///
stats(N var_u1 var_u2 var_e rho1 rho2 ll df_m aic bic pr2, ///
fmt(0 3 3 3 3 3 3 1 3 3 3) label(N Var-L1 Var-L2 Var-R ICC-L1 ICC-L2
-2LL df AIC BIC pr2)) ///
star(~ 0.10 * 0.05 ** 0.01 *** 0.001) replace
*
* 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/