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

Re: st: Re: specifying difference in H0 of ttest


From   Michel Camus <[email protected]>
To   [email protected]
Subject   Re: st: Re: specifying difference in H0 of ttest
Date   Sun, 18 Jan 2004 23:06:25 -0500

Kristen,
I simulated data with
characteristics roughly similar as those of your own data.
Christopher's solution does work. It seems to me less awkward to explain to your readership than the subtraction done by Richard, although Richard's approach seems also valid to me (I'm not a statistician, mind you.).
The results between the regression with robust s.e. and the ttest with unequal variance are similar if the Welch option is used for the ttest !
----------------------
Here are my results :
***   The following table shows the mean and sd for the 2 groups, with a test of equal variance.   ***
. sdtest concentration, by( group )
Variance ratio test
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
       1 |      10    14.47888    1.379478    4.362292    11.35828    17.59947
       2 |      15    24.89638    2.500073     9.68274    19.53425     30.2585
---------+--------------------------------------------------------------------
combined |      25    20.72938    1.886349    9.431746    16.83614    24.62261
------------------------------------------------------------------------------
                             Ho: sd(1) = sd(2)
               F(9,14) observed   = F_obs           =    0.203
               F(9,14) lower tail = F_L   = F_obs   =    0.203
               F(9,14) upper tail = F_U   = 1/F_obs =    4.927
   Ha: sd(1) < sd(2)         Ha: sd(1) != sd(2)          Ha: sd(1) > sd(2)
  P < F_obs = 0.0106     P < F_L + P > F_U = 0.0147     P > F_obs = 0.9894
=========
***   Doing with "regress , robust" ...  ***
. regress concentration group ,  robust
Regression with robust standard errors                 Number of obs =      25
                                                       F(  1,    23) =   13.23
                                                       Prob > F      =  0.0014
                                                       R-squared     =  0.3050
                                                       Root MSE      =  8.0321
------------------------------------------------------------------------------
             |               Robust
concentrat~n |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       group |    10.4175   2.864007     3.64   0.001     4.492845    16.34215
       _cons |   4.061383   3.713127     1.09   0.285    -3.619805    11.74257
------------------------------------------------------------------------------
. *** Now, testing Ho = 3 ... ***
. test group=3
 ( 1)  group = 3
       F(  1,    23) =    6.71
            Prob > F =    0.0164
**  ... doing it with a "ttest with unequal variance using Welch's statistic" AFTER subtracting 3 from the group with the highest mean.   ***
. ttest  concen3b , by(group) unequal welch
Two-sample t test with unequal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
       1 |      10    14.47888    1.379478    4.362292    11.35828    17.59947
       2 |      15    21.89638    2.500073     9.68274    16.53425     27.2585
---------+--------------------------------------------------------------------
combined |      25    18.92938    1.738753    8.693767    15.34077    22.51799
---------+--------------------------------------------------------------------
    diff |           -7.417496    2.855402               -13.33938   -1.495614
------------------------------------------------------------------------------
Welch's degrees of freedom:   21.991
                      Ho: mean(1) - mean(2) = diff = 0
     Ha: diff < 0               Ha: diff != 0              Ha: diff > 0
       t =  -2.5977                t =  -2.5977              t =  -2.5977
   P < t =   0.0082          P > |t| =   0.0164          P > t =   0.9918

The P value is 0.0164 using either the regress/robust (test group=3) or the ttest (minus-3)/unequal/Welch procedure.
Cheers.

Michel Camus, epidemiologist, Health Canada
==========================================================
Wandland, Kristen wrote:
At 11:28 AM 1/15/2004 -0500, Wandland, Kristen wrote:
Thank you all for the information so far. I have yet to digest it
all!

I think I should help with a couple of clarifications: we are
looking at potentially uneven sampling groups (n1 = 10, n2 = 15) and we do have
unequal variances.

The ultimate task at hand is to determine if the concentrations (of
a constituent) from one area are consistent with the concentrations
from the other area. EPA has requested a ttest with diff = StDev.

In that case my clunky solution from before may not be so bad after all
(although somebody will no doubt suggest yet another better way to do it!).
I'm not sure what StDev you are referring to (the SD for Y with both groups
pooled together?) but anyway lets assume you have determined it is 10; and
lets further assume the hypothesis is one tailed in that you expect group 1
to be the group that scores higher. Then

gen score2 = score
replace score2 = score2-10 if group==1
ttest score2, by(group) unequal

You could modify this along the lines of what Scott suggested to use the
saved results from summarize. Does this sound like what you wanted?
-------------------------------------------
Richard Williams, Associate Professor


This is potentially exactly what I wanted. I need to try it all out, but in
syntax it looks like it'll work.
Thank you ALL for input!

Kristen Durocher Wandland
ENSR
7041 Old Wake Forest Road
Raleigh, NC 27616
919-872-6600

************************************************************************************
Information contained in this communication is confidential and privileged proprietary information
for business use purposes only. Unauthorized use, distribution, copying or disclosure is prohibited.
If you received this communication in error, please contact the sender immediately. Thank you.
Note: this email message was swept for computer viruses.
************************************************************************************

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


--
<small>~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~</small>
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Michel Camus, Ph.D.
Épidémiologue, Div. Biostatistique et épidémiologie, DGSESC, Santé Canada
Epidemiologist, Biostatistics and Epidemiology Div., HECSB, Health Canada
Courriel / e-mail : [email protected]
Téléphone / phone     :    (514) 850-0157
Télécopieur / fax        :    (514) 850-0836
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 
* * 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