Dear all,
I'm trying to understand what is the adjusted R2 in the context of a fixed effects regression (xtreg, xtivreg2) and would like some feedback/comments. My problem is that the formula I thought makes more sense is not used anywhere in Stata, so I'm not sure of what's going on...
Background: explanation of the adjusted R2 from Quora
Common Formulas:
rss: Sum-of-squares of the residuals
tss: Sum-of-squares of the dependent variable (after demeaning)
wss: Within-sum-of-squares; similar to TSS but instead of demeaning wrt to the entire sample, demean the dependent variable within each group.
N: Number of obs.
L: Number of fixed effects (including the constant)
K: Number of other regressors besides the fixed effects (and the constant)
R2 = 1 - rss / tss
R2 Adjusted = 1 - [ rss / (N-L-K) ] / [ tss / (N-1) ]
R2 Within = 1 - rss / wss
Controversial Formula:
R2 Within Adjusted = 1 - [ rss / (N-L-K) ] / [ wss / (N-L) ]
The above is how I would write it based on the Quora link. Within each term in brackets, the numerator is is divided by the degrees of freedom available after computing that number.
This formula has two nice properties:
Problem: It's not what other packages do, not sure if I'm missing something...
1) xtreg computes it as
1 - [ rss / (N-L-K) ] / [ wss / (N-1) ]
(The only difference is -1 instead of -L)
2) (areg doesn't compute within estimates)
3) xtivreg2 (ssc) computes it as
1 - [ rss / (N-L-K) ] / [ wss / (N-0) ]
Note how the only difference is whether to substract the number of fixed effects L, substract 1, or substract 0.
Any opinions? Is that a bug in the other programs? Should I follow what they do?
Best,
Sergio
Previous discussions
[1] http://www.stata.com/statalist/archi.../msg00615.html
[2] http://www.stata.com/statalist/archi.../msg00201.html
Alternative Formulas (less relevant)
[1] http://stats.stackexchange.com/quest...-r/63766#63766
[2] http://stats.stackexchange.com/quest...re/55932#55932
[3] http://mlrv.ua.edu/2007/Vol33_1/Leach-Henson-p1-11.pdf
I'm trying to understand what is the adjusted R2 in the context of a fixed effects regression (xtreg, xtivreg2) and would like some feedback/comments. My problem is that the formula I thought makes more sense is not used anywhere in Stata, so I'm not sure of what's going on...
Background: explanation of the adjusted R2 from Quora
Common Formulas:
rss: Sum-of-squares of the residuals
tss: Sum-of-squares of the dependent variable (after demeaning)
wss: Within-sum-of-squares; similar to TSS but instead of demeaning wrt to the entire sample, demean the dependent variable within each group.
N: Number of obs.
L: Number of fixed effects (including the constant)
K: Number of other regressors besides the fixed effects (and the constant)
R2 = 1 - rss / tss
R2 Adjusted = 1 - [ rss / (N-L-K) ] / [ tss / (N-1) ]
R2 Within = 1 - rss / wss
Controversial Formula:
R2 Within Adjusted = 1 - [ rss / (N-L-K) ] / [ wss / (N-L) ]
The above is how I would write it based on the Quora link. Within each term in brackets, the numerator is is divided by the degrees of freedom available after computing that number.
This formula has two nice properties:
- With no regressors besides the fixed effects (K=0), it collapses to the within-R2 (which is also zero).
- If there is only one fixed effect (L=1), it collapses to the adjusted-R2.
Problem: It's not what other packages do, not sure if I'm missing something...
1) xtreg computes it as
1 - [ rss / (N-L-K) ] / [ wss / (N-1) ]
(The only difference is -1 instead of -L)
2) (areg doesn't compute within estimates)
3) xtivreg2 (ssc) computes it as
1 - [ rss / (N-L-K) ] / [ wss / (N-0) ]
Note how the only difference is whether to substract the number of fixed effects L, substract 1, or substract 0.
Any opinions? Is that a bug in the other programs? Should I follow what they do?
Best,
Sergio
Previous discussions
[1] http://www.stata.com/statalist/archi.../msg00615.html
[2] http://www.stata.com/statalist/archi.../msg00201.html
Alternative Formulas (less relevant)
[1] http://stats.stackexchange.com/quest...-r/63766#63766
[2] http://stats.stackexchange.com/quest...re/55932#55932
[3] http://mlrv.ua.edu/2007/Vol33_1/Leach-Henson-p1-11.pdf
Comment