# st: xtreg vs reg w/ dummies

 From Scott Hankins To statalist@hsphsun2.harvard.edu Subject st: xtreg vs reg w/ dummies Date Sun, 12 Mar 2006 21:35:43 -0500

```Hello,

I have estimated what I belive to be the same model from an econometric point of
view but Stata doesn't give me the same results.

The 1st uses "xtreg" to estimate a fixed effects model (along with "xi" for the
year effects). The 2nd uses "regress" and "xi" to generate dummy variables for
the individual fixed effects as well as year effects.

The only difference between the two routines is the coefficient on pitt is
"dropped" when I use xtreg. I thought this was a multi-colinearity problem until
I ran the regression with "regress" and dummies. It may still be a
multi-colinearity problem as I do not believe the estimated coefficient is correct.

Why does one command estimate this coefficient when the other won't? I assume
there is something subtle (or not so subtle) going on behind the scenes with Stata.

thanks

scott

**************  1st model  *****************
xi: xtreg csec i.year pitt breech previous medicaid if att_issue>=1994 ,fe
i(new_attid)
i.year            _Iyear_1994-2004    (naturally coded; _Iyear_1994 omitted)

Fixed-effects (within) regression               Number of obs      =      1002
Group variable (i): new_attid                   Number of groups   =       353

R-sq:  within  = 0.3679                         Obs per group: min =         1
between = 0.0303                                        avg =       2.8
overall = 0.1626                                        max =        10

F(14,635)          =     26.40
corr(u_i, Xb)  = -0.0949                        Prob > F           =    0.0000

------------------------------------------------------------------------------
csec |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_Iyear_1995 |  -.0457742   .0561129    -0.82   0.415    -.1559636    .0644151
_Iyear_1996 |  -.0237076   .0557849    -0.42   0.671    -.1332528    .0858377
_Iyear_1997 |  -.0281403   .0561732    -0.50   0.617     -.138448    .0821675
_Iyear_1998 |  -.0322946   .0566514    -0.57   0.569    -.1435413    .0789521
_Iyear_1999 |  -.0382227   .0567723    -0.67   0.501    -.1497069    .0732615
_Iyear_2000 |  -.0388285   .0567053    -0.68   0.494    -.1501811    .0725242
_Iyear_2001 |  -.0312434   .0567966    -0.55   0.582    -.1427752    .0802885
_Iyear_2002 |    .027376   .0568078     0.48   0.630    -.0841779    .1389299
_Iyear_2003 |  -.0026329   .0570527    -0.05   0.963    -.1146676    .1094018
_Iyear_2004 |   .0051664   .0572499     0.09   0.928    -.1072556    .1175883
pitt |  (dropped)
breech |   .7840754   .0496142    15.80   0.000     .6866476    .8815032
previous_c~c |   .3019584   .0425659     7.09   0.000     .2183714    .3855454
medicaid |    -.03466   .0199792    -1.73   0.083    -.0738933    .0045733
_cons |   .1505913   .0561206     2.68   0.007      .040387    .2607956
-------------+----------------------------------------------------------------
sigma_u |  .23549195
sigma_e |  .09962159
rho |  .84820555   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(352, 635) =     7.22            Prob > F = 0.0000
r; t=0.47 17:36:48

*********  2nd model (note: I removed the new_attid effects)  *********

xi: reg csec i.new_attid i.year pitt breech previous medicaid if att_issue>=1994
i.new_attid       _Inew_attid_1-1093  (naturally coded; _Inew_attid_1 omitted)
i.year            _Iyear_1994-2004    (naturally coded; _Iyear_1994 omitted)

Source |       SS       df       MS              Number of obs =    1002
-------------+------------------------------           F(366,   635) =    8.88
Model |  32.2576197   366  .088135573           Prob > F      =  0.0000
Residual |  6.30203251   635  .009924461           R-squared     =  0.8366
Total |  38.5596522  1001  .038521131           Root MSE      =  .09962

------------------------------------------------------------------------------
csec |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_Iyear_1995 |  -.0457742   .0561129    -0.82   0.415    -.1559636    .0644151
_Iyear_1996 |  -.0237076   .0557849    -0.42   0.671    -.1332528    .0858377
_Iyear_1997 |  -.0281403   .0561732    -0.50   0.617     -.138448    .0821675
_Iyear_1998 |  -.0322946   .0566514    -0.57   0.569    -.1435413    .0789521
_Iyear_1999 |  -.0382227   .0567723    -0.67   0.501    -.1497069    .0732615
_Iyear_2000 |  -.0388285   .0567053    -0.68   0.494    -.1501811    .0725242
_Iyear_2001 |  -.0312434   .0567966    -0.55   0.582    -.1427752    .0802885
_Iyear_2002 |    .027376   .0568078     0.48   0.630    -.0841779    .1389299
_Iyear_2003 |  -.0026329   .0570527    -0.05   0.963    -.1146676    .1094018
_Iyear_2004 |   .0051664   .0572499     0.09   0.928    -.1072556    .1175883
pitt |    .476331   .1575039     3.02   0.003     .1670394    .7856225
breech |   .7840754   .0496142    15.80   0.000     .6866476    .8815032
previous_c~c |   .3019584   .0425659     7.09   0.000     .2183714    .3855454
medicaid |    -.03466   .0199792    -1.73   0.083    -.0738933    .0045733
_cons |  -.7545818    .126352    -5.97   0.000      -1.0027   -.5064635
------------------------------------------------------------------------------
*******************************************
*
*   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/
```