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

st: Re: specifying difference in Ho of ttest


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: Re: specifying difference in Ho of ttest
Date   Wed, 14 Jan 2004 18:15:10 -0600

Isn't this just calculating the difference and then using -ttest diff = #-

Example:

. sysuse auto
(1978 Automobile Data)

. gen diff = disp - length

. ttest diff = 10

One-sample t test

------------------------------------------------------------------------------
Variable |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
    diff |      74    9.364865    8.632391    74.25863   -7.839465    26.56919
------------------------------------------------------------------------------
Degrees of freedom: 73

                             Ho: mean(diff) = 10

     Ha: mean < 10             Ha: mean != 10              Ha: mean > 10
       t =  -0.0736                t =  -0.0736              t =  -0.0736
   P < t =   0.4708          P > |t| =   0.9415          P > t =   0.5292



If you want to set it equal to the standard deviation you could define a local
macro as the standard deviation, or use it immediately following -summarize-


. sum diff

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
        diff |        74    9.364865    74.25863        -80        204

. ttest diff = `r(sd)'

One-sample t test

------------------------------------------------------------------------------
Variable |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
    diff |      74    9.364865    8.632391    74.25863   -7.839465    26.56919
------------------------------------------------------------------------------
Degrees of freedom: 73

                          Ho: mean(diff) = 74.25863

  Ha: mean < 74.25863       Ha: mean != 74.25863        Ha: mean > 74.25863
       t =  -7.5175                t =  -7.5175              t =  -7.5175
   P < t =   0.0000          P > |t| =   0.0000          P > t =   1.0000


Hope this helps,
Scott



----- Original Message ----- 
From: "Wandland, Kristen" <[email protected]>
To: <[email protected]>
Sent: Wednesday, January 14, 2004 11:01 AM
Subject: st: specifying difference in Ho of ttest


> Does anyone know a way to specify the difference in a ttest? The default
> result is:
>
> Ho = diff = 0
>
> I hope to be able to do:
>
> Ho = diff = #
>
> where # is the standard deviation or other pre-determined value.
>
> Thanks all.
>
> Kristen Durocher Wandland

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