Petroulas Pavlos --
It's not clear what the observed problem is, since you do not
characterize the data or output. Is it that some year variables are
dropped in the estimation? If not, you should get the same coefficient
and understated SEs with your "by-hand" method--see the example below.
That said, you may find -help xtdata- a useful help file.
webuse grunfeld, clear
ren com panel
ren mval Y
ren ksto X
xi: areg Y i.year X, abs(panel)
est sto areg
egen mpanelY=mean(Y), by(panel)
egen mpanelX=mean(X), by(panel)
egen mtY=mean(Y), by(year)
egen mtX=mean(X), by(year)
egen mY=mean(Y)
egen mX=mean(X)
ren Y Yold
ren X Xold
gen Y=Yold-mpanelY-mtY+mY
gen X=Xold-mpanelX-mtX+mX
regress Y X, noc
est sto byhand
ssc inst estout, replace
esta *, keep(X) se
On 6/5/07, Petroulas Pavlos <[email protected]> wrote:
I have a panel dataset with i(panels)=476 and t(years)=11 which includes
missing values. If I use the command
xi: regress Y i.panels i.years X
my results seem to be fine.
The above approach should in principal be equivalent to a double
demeaning process. However if I make a double demeaning of the following
fom:
<snip>
regress Y X, noc
the results are vastly different, while in principal they should be the
same (or close to being the same).
It seems that this is due to collinearity issues between some panel
fixed effects and some time fixed effects, as the dummies are over
determined, which Stata automatically takes into consideration.
The point here is that I would like to create a demeaned dataset. Is
there a way to identify collinearity between regressors so that I can
take it into account when demeaning my variables? Is there any problem
with the way Stata calculates means with an unbalanced panel?
*
* 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/