Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: ttest vs. lincom


From   "David Richmond" <[email protected]>
To   <[email protected]>
Subject   st: ttest vs. lincom
Date   Tue, 25 Jan 2005 13:16:14 -0500

Hi all,

When I use ttest to test pre- vs. post-treatment means, I get one value
for t.
When I use lincom with the respondent_id as the psu, I get a different
value.
Is the ttest command preferred, and if so, what is the difference in the
two tests?

. ttest communication, by(survey_num)

Two-sample t test with equal variances

------------------------------------------------------------------------
------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf.
Interval]
---------+--------------------------------------------------------------
------
    pre- |      40       3.425    .1272868    .8050322    3.167538
3.682462
   post- |      40       3.675    .0728319    .4606294    3.527684
3.822316
---------+--------------------------------------------------------------
------
combined |      80        3.55    .0742046    .6637065    3.402299
3.697701
---------+--------------------------------------------------------------
------
    diff |                -.25    .1466506                -.541959
.041959
------------------------------------------------------------------------
------
Degrees of freedom: 78

                   Ho: mean(pre-) - mean(post-) = diff = 0

     Ha: diff < 0               Ha: diff != 0              Ha: diff > 0
       t =  -1.7047                t =  -1.7047              t =
-1.7047
   P < t =   0.0461          P > |t| =   0.0922          P > t =
0.9539

. svymean communication, by(survey_num)

Survey mean estimation

pweight:  <none>                                  Number of obs    =
80
Strata:   <one>                                   Number of strata =
1
PSU:      respondent_id                           Number of PSUs   =
40
                                                  Population size  =
80

------------------------------------------------------------------------
------
Mean   Subpop. |   Estimate    Std. Err.   [95% Conf. Interval]
Deff
---------------+--------------------------------------------------------
------
communication  |
          pre- |      3.425    .1272868    3.167538    3.682462
1.012821
         post- |      3.675    .0728319    3.527684    3.822316
1.012821
------------------------------------------------------------------------
------

. lincom [communication]pre - [communication]post

 ( 1)  [communication]pre- - [communication]post- = 0

------------------------------------------------------------------------
------
        Mean |   Estimate   Std. Err.      t    P>|t|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
         (1) |       -.25   .1187542    -2.11   0.042    -.4902031
-.0097969
------------------------------------------------------------------------
------

Thanks,
David Richmond

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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index