Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: RE: Difference in Difference vs. Fixed Effects

 From Joerg Lang <[email protected]> To [email protected] Subject Re: st: RE: Difference in Difference vs. Fixed Effects Date Thu, 3 Oct 2013 10:55:03 +0200

```I am sorry! This shouldn't have been sent in such a format. Here is
now the edited version of the tables. As you can see, they are -
despite some minor changes in the standard - pretty much the same when
there are no other covariates included. However, including these
covariates leads to more different results. If there is anyone that
could help me explaining what is either wrong with my Stata command or
point me in the right direction for the interpretiation that would be
The did denotes the difference in differece estimator and is thus the
one of interest. The treatment dummy is only included in the xtreg for
better "comparison". Obviously, one could have also construcet a
treatment dummy that varies between the time periods, i.e. 0 for both
treatment and control grouop in the baseline period and 1 for the
treatment group in the followup while 0 for the control group in the
followup. However, leaving the did estimator should yield the same
result since this is an interaction of treatment and time and thus 0
for both groups in the baseline period since time is 0. The value is 1
for the treatment group in the followup since both variables are then
1 but 0 for the case of the control group in the followup since the
control groups value is 0.

reg gender_decision did treatment followup, cluster (h1)

Linear regression                                      Number of obs =     636
F(  3,
317) =    5.77
Prob >
F      =  0.0007

R-squared     =  0.0233
Root
MSE      =   .3456

318 clusters in h1)
------------------------------------------------------------------------------
Robust
gender_dec~n |      Coef.       Std. Err.      t    P>|t|     [95%
Conf. Interval]
-------------+----------------------------------------------------------------
did |   .0913309   .0678396     1.35   0.179
-.0421419    .2248037
treatment |  -.0164835   .0396981    -0.42   0.678
-.0945886    .0616215
followup |   .0864469   .0292938     2.95   0.003
.028812    .1440818
_cons |   .2387057   .0157684    15.14   0.000
.2076819    .2697296
------------------------------------------------------------------------------

xtreg gender_decision treatment did followup, fe vce(cluster h1)
note: treatment omitted because of collinearity

Fixed-effects (within) regression               Number of obs      =       636
Group variable: h1                                 Number of groups
=       318

R-sq:  within  = 0.0465                         Obs per group: min =         2
between = 0.0016
avg =       2.0
overall = 0.0230
max =         2

F(2,317)
=      8.59
corr(u_i, Xb)  = -0.0067                        Prob > F           =    0.0002

(Std. Err. adjusted for 318 clusters in h1)
------------------------------------------------------------------------------
|                          Robust
gender_dec~n |      Coef.      Std. Err.      t       P>|t|
[95% Conf. Interval]
-------------+----------------------------------------------------------------
treatment |          0  (omitted)
did |   .0913309    .067786     1.35   0.179
-.0420364    .2246982
followup |   .0864469   .0292707     2.95   0.003
.0288575    .1440363
_cons |   .2363732   .0132882    17.79   0.000
.210229    .2625174
-------------+----------------------------------------------------------------
sigma_u |  .25124096
sigma_e |  .33511619
rho |  .35982364   (fraction of variance due to u_i)
------------------------------------------------------------------------------

With more controls:

reg gender_decision did treatment followup log_hhsize h16_hoh
h16_hohsp hohdum_edu_no_imp sphohdum
> _edu_no_imp asset_Index_imp women_groupmember log_hexp, cluster (h1)

Linear regression                                      Number of obs =     636
F( 11,
317) =    2.64
Prob > F
=  0.0030

R-squared     =  0.0379
Root MSE
=  .34518

clusters in h1)
-------------------------------------------------------------------------------------
|               Robust
gender_decision |      Coef.   Std. Err.      t    P>|t|
[95% Conf. Interval]
--------------------+----------------------------------------------------------------
did |   .0775325   .0689252     1.12
0.261    -.0580762    .2131412
treatment |  -.0422406   .0423164    -1.00
0.319     -.125497    .0410158
followup |   .0816601   .0315261     2.59
0.010     .0196332     .143687
log_hhsize |  -.0050365      .0308    -0.16   0.870
-.0656347    .0555617
h16_hoh |   .0002403   .0019649     0.12   0.903
-.0036256    .0041061
h16_hohsp |   -.000707   .0023795    -0.30   0.767
-.0053886    .0039746
hohdum_edu_no_imp |    .015657   .0364541     0.43   0.668
-.0560656    .0873795
s phohdum_edu_no_imp |   .0712825   .0410581     1.74   0.084
-.0094982    .1520633
asset_Index_imp |   .0650232   .0761579     0.85   0.394
-.0848155     .214862
women_groupmember |   .0290404     .03097     0.94   0.349
-.0318924    .0899731
log_hexp |   .0190211   .0207127     0.92
0.359    -.0217307    .0597728
_cons |   .0026582   .2046481     0.01
0.990    -.3999819    .4052984
-------------------------------------------------------------------------------------

xtreg gender_decision treatment did followup log_hhsize h16_hoh
h16_hohsp hohdum_edu_no_imp sphohd
> um_edu_no_imp asset_Index_imp women_groupmember log_hexp, fe vce(cluster h1)
note: treatment omitted because of collinearity

Fixed-effects (within) regression               Number of obs      =       636
Group variable: h1                              Number of groups   =       318

R-sq:  within  = 0.0723                         Obs per group: min =         2
between = 0.0005                                        avg =       2.0
overall = 0.0140                                        max =         2

F(10,317)          =      2.80
corr(u_i, Xb)  = -0.2809                        Prob > F           =    0.0024

clusters in h1)
-------------------------------------------------------------------------------------
|               Robust
gender_decision |      Coef.   Std. Err.      t    P>|t|
[95% Conf. Interval]
--------------------+----------------------------------------------------------------
treatment |          0  (omitted)
did |   .0944656   .0685701     1.38
0.169    -.0404444    .2293756
followup |   .0637825   .0348781     1.83
0.068    -.0048393    .1324043
log_hhsize |  -.0601096   .0553426    -1.09   0.278
-.1689948    .0487756
h16_hoh |  -.0014844   .0055086    -0.27   0.788
-.0123225    .0093537
h16_hohsp |    .005337   .0047125     1.13   0.258
-.0039347    .0146088
hohdum_edu_no_imp |   .1778034   .0849698     2.09   0.037
.0106275    .3449793
sphohdum_edu_no_imp |   .0998635   .0816447     1.22   0.222
-.0607705    .2604975
asset_Index_imp |   .0307611   .1463719     0.21   0.834
-.257222    .3187443
women_groupmember |   .0098729   .0503457     0.20   0.845
-.0891811    .1089268
log_hexp |  -.0025051   .0278105    -0.09   0.928
-.0572215    .0522113
_cons |   .1998801   .3670395     0.54
0.586    -.5222612    .9220215
--------------------+----------------------------------------------------------------
sigma_u |  .26714979
sigma_e |  .33481165
rho |  .38900009   (fraction of variance due to u_i)
-------------------------------------------------------------------------------------

2013/10/3 Joerg Lang <[email protected]>:
> Hey Mustafa,
>
> thanks for your response. I think that my sentence with the treatment
> was kind of misleading. Treatment is the dummy for treatment but what
> I really want to know is the Difference in Difference dummy (did).
> I have the results below:
>
>
>
>
>
>  reg gender_decision did treatment followup, cluster (h1)
>
> Linear regression                                      Number of obs =     636
>                                                        F(  3,   317) =    5.77
>                                                        Prob > F      =  0.0007
>                                                        R-squared     =  0.0233
>                                                        Root MSE      =   .3456
>
>                                    (Std. Err. adjusted for 318 clusters in h1)
> ------------------------------------------------------------------------------
>              |               Robust
> gender_dec~n |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>          did |   .0913309   .0678396     1.35   0.179    -.0421419    .2248037
>    treatment |  -.0164835   .0396981    -0.42   0.678    -.0945886    .0616215
>     followup |   .0864469   .0292938     2.95   0.003      .028812    .1440818
>        _cons |   .2387057   .0157684    15.14   0.000     .2076819    .2697296
> ------------------------------------------------------------------------------
>
>
>
>
>
> xtreg gender_decision treatment did followup, fe vce(cluster h1)
> note: treatment omitted because of collinearity
>
> Fixed-effects (within) regression               Number of obs      =       636
> Group variable: h1                              Number of groups   =       318
>
> R-sq:  within  = 0.0465                         Obs per group: min =         2
>        between = 0.0016                                        avg =       2.0
>        overall = 0.0230                                        max =         2
>
>                                                 F(2,317)           =      8.59
> corr(u_i, Xb)  = -0.0067                        Prob > F           =    0.0002
>
>                                    (Std. Err. adjusted for 318 clusters in h1)
> ------------------------------------------------------------------------------
>              |               Robust
> gender_dec~n |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>    treatment |          0  (omitted)
>          did |   .0913309    .067786     1.35   0.179    -.0420364    .2246982
>     followup |   .0864469   .0292707     2.95   0.003     .0288575    .1440363
>        _cons |   .2363732   .0132882    17.79   0.000      .210229    .2625174
> -------------+----------------------------------------------------------------
>      sigma_u |  .25124096
>      sigma_e |  .33511619
>          rho |  .35982364   (fraction of variance due to u_i)
> ------------------------------------------------------------------------------
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  reg gender_decision did treatment followup log_hhsize h16_hoh
> h16_hohsp hohdum_edu_no_imp sphohdum
>> _edu_no_imp asset_Index_imp women_groupmember log_hexp, cluster (h1)
>
> Linear regression                                      Number of obs =     636
>                                                        F( 11,   317) =    2.64
>                                                        Prob > F      =  0.0030
>                                                        R-squared     =  0.0379
>                                                        Root MSE      =  .34518
>
>                                           (Std. Err. adjusted for 318
> clusters in h1)
> -------------------------------------------------------------------------------------
>                     |               Robust
>     gender_decision |      Coef.   Std. Err.      t    P>|t|     [95%
> Conf. Interval]
> --------------------+----------------------------------------------------------------
>                 did |   .0775325   .0689252     1.12   0.261
> -.0580762    .2131412
>           treatment |  -.0422406   .0423164    -1.00   0.319
> -.125497    .0410158
>            followup |   .0816601   .0315261     2.59   0.010
> .0196332     .143687
>          log_hhsize |  -.0050365      .0308    -0.16   0.870
> -.0656347    .0555617
>             h16_hoh |   .0002403   .0019649     0.12   0.903
> -.0036256    .0041061
>           h16_hohsp |   -.000707   .0023795    -0.30   0.767
> -.0053886    .0039746
>   hohdum_edu_no_imp |    .015657   .0364541     0.43   0.668
> -.0560656    .0873795
> sphohdum_edu_no_imp |   .0712825   .0410581     1.74   0.084
> -.0094982    .1520633
>     asset_Index_imp |   .0650232   .0761579     0.85   0.394
> -.0848155     .214862
>   women_groupmember |   .0290404     .03097     0.94   0.349
> -.0318924    .0899731
>            log_hexp |   .0190211   .0207127     0.92   0.359
> -.0217307    .0597728
>               _cons |   .0026582   .2046481     0.01   0.990
> -.3999819    .4052984
> -------------------------------------------------------------------------------------
>
>
>
>
>  xtreg gender_decision treatment did followup log_hhsize h16_hoh
> h16_hohsp hohdum_edu_no_imp sphohd
>> um_edu_no_imp asset_Index_imp women_groupmember log_hexp, fe vce(cluster h1)
> note: treatment omitted because of collinearity
>
> Fixed-effects (within) regression               Number of obs      =       636
> Group variable: h1                              Number of groups   =       318
>
> R-sq:  within  = 0.0723                         Obs per group: min =         2
>        between = 0.0005                                        avg =       2.0
>        overall = 0.0140                                        max =         2
>
>                                                 F(10,317)          =      2.80
> corr(u_i, Xb)  = -0.2809                        Prob > F           =    0.0024
>
>                                           (Std. Err. adjusted for 318
> clusters in h1)
> -------------------------------------------------------------------------------------
>                     |               Robust
>     gender_decision |      Coef.   Std. Err.      t    P>|t|     [95%
> Conf. Interval]
> --------------------+----------------------------------------------------------------
>           treatment |          0  (omitted)
>                 did |   .0944656   .0685701     1.38   0.169
> -.0404444    .2293756
>            followup |   .0637825   .0348781     1.83   0.068
> -.0048393    .1324043
>          log_hhsize |  -.0601096   .0553426    -1.09   0.278
> -.1689948    .0487756
>             h16_hoh |  -.0014844   .0055086    -0.27   0.788
> -.0123225    .0093537
>           h16_hohsp |    .005337   .0047125     1.13   0.258
> -.0039347    .0146088
>   hohdum_edu_no_imp |   .1778034   .0849698     2.09   0.037
> .0106275    .3449793
> sphohdum_edu_no_imp |   .0998635   .0816447     1.22   0.222
> -.0607705    .2604975
>     asset_Index_imp |   .0307611   .1463719     0.21   0.834
> -.257222    .3187443
>   women_groupmember |   .0098729   .0503457     0.20   0.845
> -.0891811    .1089268
>            log_hexp |  -.0025051   .0278105    -0.09   0.928
> -.0572215    .0522113
>               _cons |   .1998801   .3670395     0.54   0.586
> -.5222612    .9220215
> --------------------+----------------------------------------------------------------
>             sigma_u |  .26714979
>             sigma_e |  .33481165
>                 rho |  .38900009   (fraction of variance due to u_i)
> -------------------------------------------------------------------------------------
>
> 2013/10/2 Hussein, Mustafa (Mustafa Hussien) <[email protected]>:
>> Hi Joerg,
>>
>> Can you post your results? You say that "treatment" was omitted from xtreg output. So what are you comparing your reg coefficients to then? In fixed effects I think you should be able specify a dummy for treatment.
>>
>> Mustafa
>>
>> ________________________________________
>> From: [email protected] [[email protected]] on behalf of Joerg Lang [[email protected]]
>> Sent: Wednesday, October 02, 2013 1:26 AM
>> To: [email protected]
>> Subject: st: Difference in Difference vs. Fixed Effects
>>
>> Dear Stalist users,
>>
>> currently writing my Master thesis and working with
>> Stata 12, I have the following problem.
>>
>> I have a dataset on two time periods (2010 and 2012) and two groups
>> (treatment and control). There is no treatment in the baseline and the
>> treatment group uptakes the treatment between 2010 and 2012. The uptake is
>> non-random.
>> Now, I want to estimate the impact in a difference in difference design.
>> At first, I estimate the following model:
>>  y b0+b1Time+b2Treatment+b3Time*Treatment+u
>>
>> using the -reg command:
>>
>> -reg y time treatment time*treatment, cluster (h1)
>>
>> while y is the outcome variable that is between 0 and 1 and h1 is the
>> household identifier. I use the cluster option to account for the problem
>> of serial correlation. In a second estimation I also include some other
>> covariates.
>>
>> I always thought that this setting and a setting with fixed effects
>> yield exactly the same result as long as one has only two points in time
>> (in my case 2010 and 2012).
>>
>> However, estimating the same model with:
>>
>> - xtreg y Time Treatment Time*Treatment, fe vce(cluster h1)
>>
>> gives slightly different results. The difference increases when including
>> more covariates, which are the same in both cases. As well, there is no
>> variation in the households. Thus, the same households and the same
>> variables are used in both estimations.
>> Obviously, treatment is omitted in the xtreg case since it does not vary
>> between time.
>> However, I think that this should not change anything.
>> My question is:
>>  Is my model correctly specified or did I overlook something?
>> And, if my estimation is correct: Why this difference? Is this "normal"? If
>> so, what does it tell me then, i.e. what is the reason for it?
>>
>> Since I have already been stuck with this problem for quite a while, any
>> help or literature suggestions  would be very much appreciated.  Hope
>> this question is not too trivial for you.
>>
>> Best regards,
>>
>> Joerg
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```