# Include time dummies with xtreg,fe? [closed]

Is running:

xtset panelvar timevar

xtreg dep indep, fe


the same as just running

xtset panelvar

xtreg dep indep timedummies, fe


In other words, should I include time dummies in my FE regression, even though I have xtset the data? or does the regression already control for time-varying effects?

• Questions solely about how software works are off-topic here, but you may have a real statistical question buried here. You may want to edit your question to clarify the underlying statistical issue. You may find that when you understand the statistical concepts involved, the software-specific elements are self-evident or at least easy to get from the documentation. – gung - Reinstate Monica Jun 19 '16 at 13:04
• Never cite software commands without naming the software. Here it's Stata. (Tag added.) – Nick Cox Jun 19 '16 at 15:52

The Stata xtreg, fe command provides only "one-way" fixed-effects estimation, you have to add the time dimension manually to get a "two-way" fixed-effects model controlling for the time dimension too, see Statalist or this example here

* Load data
use http://www.stata-press.com/data/r13/nlswork, clear
xtset id year
gen age2 = age*age
xtreg ln_wage age age2 hours, fe

. xtreg ln_wage age age2 hours, fe

Fixed-effects (within) regression               Number of obs     =     28,443
Group variable: idcode                          Number of groups  =      4,709

R-sq:                                           Obs per group:
within  = 0.1096                                         min =          1
between = 0.1070                                         avg =        6.0
overall = 0.0899                                         max =         15

F(3,23731)        =     973.67
corr(u_i, Xb)  = 0.0496                         Prob > F          =     0.0000

------------------------------------------------------------------------------
ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
age |   .0542456   .0028118    19.29   0.000     .0487342    .0597569
age2 |  -.0006019   .0000466   -12.92   0.000    -.0006933   -.0005106
hours |   .0008024   .0002386     3.36   0.001     .0003348      .00127
_cons |   .6053712   .0420964    14.38   0.000     .5228596    .6878828
-------------+----------------------------------------------------------------
sigma_u |  .40174893
sigma_e |  .30244087
rho |  .63827457   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(4708, 23731) = 8.59                 Prob > F = 0.0000


compared to

*
xi: xtreg ln_wage age age2 hours i.year, fe

. xi: xtreg ln_wage age age2 hours i.year, fe
i.year            _Iyear_68-88        (naturally coded; _Iyear_68 omitted)

Fixed-effects (within) regression               Number of obs     =     28,443
Group variable: idcode                          Number of groups  =      4,709

R-sq:                                           Obs per group:
within  = 0.1168                                         min =          1
between = 0.1129                                         avg =        6.0
overall = 0.0959                                         max =         15

F(17,23717)       =     184.52
corr(u_i, Xb)  = 0.0653                         Prob > F          =     0.0000

------------------------------------------------------------------------------
ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
age |   .0728637      .0108     6.75   0.000     .0516951    .0940323
age2 |  -.0010067   .0000611   -16.47   0.000    -.0011264   -.0008869
hours |   .0006501   .0002384     2.73   0.006     .0001828    .0011174
_Iyear_69 |    .064022    .015834     4.04   0.000     .0329864    .0950577
... omitted ...
_Iyear_88 |   .1854314   .2070028     0.90   0.370    -.2203074    .5911702
_cons |   .3681646   .2005458     1.84   0.066    -.0249179    .7612471
-------------+----------------------------------------------------------------
sigma_u |  .40080955
sigma_e |  .30130221
rho |  .63893511   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(4708, 23717) = 8.61                 Prob > F = 0.0000