# st: Question on "ttest" command

 From kannika damrongplasit To statalist@hsphsun2.harvard.edu Subject st: Question on "ttest" command Date Mon, 10 Oct 2005 19:15:25 -0700

```To Stata Users,

I am writing to ask about how to compute standard error associated with the differential change for treatment effect evaluation.

Here is the concept.

Group                 Before the policy            After the policy             Change          Differential Change

Treatment                     A                                    B                                 B-A               (B-A)-(Y-X)

Control                          X                                    Y                                 Y-X

where A, B, X, and Y are the average value (i.e. mean) of each group.  My goal is to evaluate the impact of the policy by computing the differential change (B-A)-(Y-X).  In addition to finding the mean of each cell, I also need to find the associated standard error for each of them.

I use the command “ttest” to compute all the numerical value for the column entitled “Change”.  The command ttest and the results are shown below for both treatment and control groups.

ttest smoke if nt==1, by(before)      --> treatment group

Two-sample t test with equal variances

------------------------------------------------------------------------------
Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
0 |    1332    .2845345    .0123672    .4513619    .2602731    .3087959
1 |     222    .2342342     .028489    .4244764    .1780894    .2903791
---------+--------------------------------------------------------------------
combined |    1554    .2773488    .0113604    .4478342    .2550655     .299632
---------+--------------------------------------------------------------------
diff |            .0503003    .0324503               -.0133507    .1139513
------------------------------------------------------------------------------
Degrees of freedom: 1552

Ho: mean(0) - mean(1) = diff = 0

Ha: diff < 0               Ha: diff != 0              Ha: diff > 0
t =   1.5501                t =   1.5501              t =   1.5501
P < t =   0.9393          P > |t| =   0.1213          P > t =   0.0607

ttest smoke if decrim==0, by(before)  --> control group

Two-sample t test with equal variances

------------------------------------------------------------------------------
Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
0 |   16152    .1618995    .0028985      .36837    .1562181    .1675808
1 |    2108     .142315    .0076113    .3494558    .1273886    .1572414
---------+--------------------------------------------------------------------
combined |   18260    .1596386    .0027106    .3662805    .1543255    .1649516
---------+--------------------------------------------------------------------
diff |            .0195845    .0084813                .0029602    .0362087
------------------------------------------------------------------------------
Degrees of freedom: 18258

Ho: mean(0) - mean(1) = diff = 0

Ha: diff < 0               Ha: diff != 0              Ha: diff > 0
t =   2.3091                t =   2.3091              t =   2.3091
P < t =   0.9895          P > |t| =   0.0209          P > t =   0.0105

What I want to do next is to compute the “Differential Change” and its associated standard error.  The average differential change is easy to compute.  I just uses the information provided in the “Diff” rows.

The average differential change is (.0503003 - .0195845) = 0.0307158

MY QUESTION: HOW CAN I CALCULATE THE ASSOCIATED STANDARD ERROR FOR THIS DIFFERENTIAL CHANGE (i.e. standard error of (B-A)-(Y-X)?  In other words, I would like to find out whether 0.0307158 is significantly different from zero.  Please let me know which command in STATA can be used here.  Can I use the "ttest" command?  If so, how? Is there user written command for it?

Best regards,

Kannika

*
*   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/
```