Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: R2's from xtreg

From   Christopher Baum <>
To   "" <>
Subject   Re: st: R2's from xtreg
Date   Thu, 17 Nov 2011 09:51:26 -0500

On Nov 17, 2011, at 2:33 AM, Daifeng wrote:

> Here is what the Manual Says:  the overall R2 corresponds to Eq(1),
> the between R2 corresponds to Eq(2), and the within R2 corresponds to
> Eq(3).  (Sorry, the equations are uly and hard to read, but Statlist
> does not allow formatting..)
> y_it_hat = a + b*x_it                       (1)
> y_it_bar = a + b*x_it_bar                 (2)
> (y_it-y_i_bar)= b*(x_it - xi_bar)         (3 )

In linear regression with a constant term (or with many constant terms), R^2 can always be written as the squared correlation of Y and Yhat. If you do

webuse grunfeld
xtreg invest mvalue, fe
predict ihat, xb
corr ihat invest
di r(rho)^2

you will see that the 'overall' R^2 is this measure: the squared correlation of actual and predicted values.

If you do the same thing with areg -- areg invest mvalue, absorb(company) -- it gives you a different R^2. However if you save the predicted values and look at their squared correlation with invest, you will get the same R^2 as you do in xtreg, fe as the 'overall' R^2.

Note that the 'xb' predictions after areg are not the same as those from an equivalent regression; you need the 'xbd' predict option for that. Likewise, for xtreg, fe, it is the xbu option that produces the same predicted values as those from a regression including the dummy variables. 


Kit Baum   |   Boston College Economics & DIW Berlin   |
                             An Introduction to Stata Programming  |
  An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index