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.
*
* 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/