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, statalist.org 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 <kit.baum@bc.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                             An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
  An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index