There is a clear FAQ about this:
http://www.stata.com/support/faqs/stat/xtreg2.html
Philippe
>-----Original Message-----
>From: [email protected]
>[mailto:[email protected]]
>Sent: Friday, February 10, 2006 8:33 AM
>To: [email protected]
>Subject: statalist-digest V4 #2244
>
>statalist-digest Friday, February 10 2006 Volume 04
>: Number 2244
>
>Date: Thu, 9 Feb 2006 14:44:37 -0500
>From: Austin Nichols <[email protected]>
>Subject: Re: st: demened regression and FE are not the same
>
>Only the constant term and standard errors should be different using
>the "manual fixed effects" approach of subtracting the mean (over all
>obs within id) of each explanatory variable. The coef on the variable
>of interest will be the same. What were you expecting to find? (Note
>that if you demean your Y var too, the constant term should be very
>very close to zero.)
>
>. webuse grunfeld, clear
>. areg invest kstock, a(company)
>-
>---------------------------------------------------------------
>---------------
> invest | Coef. Std. Err. t P>|t| [95%
>Conf. Interval]
>-
>-------------+-------------------------------------------------
>---------------
> kstock | .3707496 .0193676 19.14 0.000
>.3325452 .4089541
> _cons | 43.62499 6.984315 6.25 0.000
>29.84777 57.40222
>-
>-------------+-------------------------------------------------
>---------------
>. egen k_m=mean(ks), by(company)
>. gen k_dm=ks-k_m
>. reg invest k_dm2
>-
>---------------------------------------------------------------
>---------------
> invest | Coef. Std. Err. t P>|t| [95%
>Conf. Interval]
>-
>-------------+-------------------------------------------------
>---------------
> k_dm2 | .3707496 .0607801 6.10 0.000
>.2508901 .4906091
> _cons | 145.9583 14.10573 10.35 0.000
>118.1415 173.775
>-
>---------------------------------------------------------------
>---------------
>
>
>
>On 2/9/06, [email protected] <[email protected]> wrote:
>> Does anyone know why the demeaned regression does not give
>the same results as the fixed-effects regression?
>>
>> when I run
>> xtreg Y X , fe
>> areg Y X , a(id)
>>
>> I get the same answer. However, when I run
>> xi: reg Y i.id
>> predict Y1 , resid
>> xi: reg X i.id
>> predict X1 , resid
>> reg Y1 X1
>>
>> I get a different answer. I have also explicity demeaned the
>variables using
>> foreach var of varlist X Y {
>> egen mean_`var'_id = mean(`var'), by(id)
>> gen demean_`var' = mean_`var'_id - `var'
>> }
>> reg demean_Y demean_X
>>
>> This gives the same asnwer as the residual regression, but
>NOT the same as the
>> fixed effects or entity dummy regression.
>>
>> Does anyone have any idea why this is the case?
>>
>> Mathematically these 4 approaches are supposed to be identical.
>
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept
**********************************************************************
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/