# st: difference-in-difference

 From "Hans J. Baumgartner" To statalist@hsphsun2.harvard.edu Subject st: difference-in-difference Date Fri, 24 Jun 2005 15:11:00 +0200

```Dear statalist,

I am trying to obtain the difference-in-difference estimator by using
ttest. However, I got stocked somewhere half way.

I ttested the difference in two groups. (see below). What I would like to
do now is to check the difference of these two differences. Is there
anyway to do this?`

. ttest gruppe11 = gruppe10, unpaired

Two-sample t test with equal variances

------------------------------------------------------------------------------
Variable |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf.
Interval]
---------+--------------------------------------------------------------------
gruppe11 |      36    .4444444    .0839921    .5039526    .2739314
.6149575
gruppe10 |     203    .4187192    .0347119    .4945689     .350275
.4871634
---------+--------------------------------------------------------------------
combined |     239    .4225941    .0320194    .4950087    .3595164
.4856719
---------+--------------------------------------------------------------------
diff |            .0257252    .0896915               -.1509692
.2024197
------------------------------------------------------------------------------
Degrees of freedom: 237

Ho: mean(gruppe11) - mean(gruppe10) = diff = 0

Ha: diff < 0               Ha: diff != 0              Ha: diff > 0
t =   0.2868                t =   0.2868              t =   0.2868
P < t =   0.6127          P > |t| =   0.7745          P > t =   0.3873

. ttest gruppe01 = gruppe00, unpaired

Two-sample t test with equal variances

------------------------------------------------------------------------------
Variable |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf.
Interval]
---------+--------------------------------------------------------------------
gruppe01 |      57    .7017544    .0611344    .4615545    .5792875
.8242213
gruppe00 |     285    .5017544    .0296694    .5008764    .4433546
.5601541
---------+--------------------------------------------------------------------
combined |     342    .5350877    .0270098    .4994981     .481961
.5882144
---------+--------------------------------------------------------------------
diff |                  .2    .0717663                .0588382
.3411618
------------------------------------------------------------------------------
Degrees of freedom: 340

Ho: mean(gruppe01) - mean(gruppe00) = diff = 0

Ha: diff < 0               Ha: diff != 0              Ha: diff > 0
t =   2.7868                t =   2.7868              t =   2.7868
P < t =   0.9972          P > |t| =   0.0056          P > t =   0.0028

++++++++++++++++++++++++++++++++
Hans J. Baumgartner
Dept. Public Economics
DIW Berlin
German Institut for Economic Research
phone: +49/30/89789-307
fax :      +49/30/89789-114
URL: www.diw.de
www.hansbaumgartner.de
++++++++++++++++++++++++++++++++
*
*   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/
```