I am working with a panel dataset and have tried 4 ways to estimate a two
way fixed effect that controls for year and group fixed effects. (Hopefully
you can follow my notation)
egen Yi.=mean(Yit), by(group);
egen Y..=mean(Yit);
egen Y.t=mean(Yit), by(year);
(1) xi: xtreg y x i.year, i(group) fe;
(2) reg y* x* year1* year2* . . . year5*;
where y*=Yit-Yi.+Y.. and other * variables defined similarly)
(3) reg y** x** year1** year2** . . . year5**, noconstant;
where y**=Yit-Yi. and other ** variables defined similarly
(4) reg y*** x***, no constant;
where y***=Yit-Yi.-Y.t+Y.. and x*** defined similarly
(1) and (2) provide very similar, but exactly the same, coefficient
estimates. The estiamtes produced by (3) and (4)are both different from
each other and different from (1) and (2). Can anyone explain why each of
these do not provide the same coefficient estimates.
*
* 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/