Ed230B/C

Linear Statistical Models

Two-Group Dependent t-test


The t-test for dependent samples can be used to examine data from within-subjects designs when two observations are made on each subject. The dependent t-test is sometimes call the t-test for repeated measures because it can be used in situations involving collectiong two measures on each subject. The same formula and logic applies to studies involving siblings or research on husbands and wives in the same family.

Hypotheses

  • 2-tail - H0: md = 0 H1: md <> 0
  • 1-tail - H0: md <= 0 H1: md > 0
  • 1-tail - H0: md >= 0 H1: md < 0

    Assumptions

  • Normality.
  • Homogeneity of Variance.

    The Trick to the Dependent t-test

  • Compute the difference between the two scores.
  • Use the single sample t-test formula.

    Formulas

  • Standart Deviation for the Differences

  • Dependent t-test

    Example

    Consider these hypothetical scores for husbands and wives regarding their attitudes towards bilingual education.

    WivesHusbands  d
    107102  5
    120109 11
    100111-11
    121117  4
    116121 -5
    109103  6
    120111  9
    115110  5
    117109  8
    123114  9
    108109  -1
    121113  8
    mean  4

    Stata Analysis of Example

    input wife husb
    107 102
    120 109
    100 111
    121 117
    116 121
    109 103
    120 111
    115 110
    117 109
    123 114
    108 109
    121 113
    end
      
    generate diff = wife-husb
     
    ttest wife=husb
    
    Paired t test
    
    ------------------------------------------------------------------------------
    Variable |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
    ---------+--------------------------------------------------------------------
        wife |      12      114.75    2.067516    7.162085    110.1994    119.3006
        husb |      12      110.75    1.523179    5.276449    107.3975    114.1025
    ---------+--------------------------------------------------------------------
        diff |      12           4    1.882938    6.522688    -.144318    8.144318
    ------------------------------------------------------------------------------
    
                        Ho: mean(wife - husb) = mean(diff) = 0
    
      Ha: mean(diff) < 0         Ha: mean(diff) != 0        Ha: mean(diff) > 0
           t =   2.1243                t =   2.1243              t =   2.1243
       P < t =   0.9714          P > |t| =   0.0571          P > t =   0.0286
     
    ttest diff=0
    
    One-sample t test
    
    ------------------------------------------------------------------------------
    Variable |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
    ---------+--------------------------------------------------------------------
        diff |      12           4    1.882938    6.522688    -.144318    8.144318
    ------------------------------------------------------------------------------
    Degrees of freedom: 11
    
                                 Ho: mean(diff) = 0
    
         Ha: mean < 0               Ha: mean != 0              Ha: mean > 0
           t =   2.1243                t =   2.1243              t =   2.1243
       P < t =   0.9714          P > |t| =   0.0571          P > t =   0.0286
       
    display 2.1242^2
    
    4.5122256
    Using ANOVA

    input pairid a y 
    1          1        107  
    1          2        102  
    2          1        120  
    2          2        109  
    3          1        100  
    3          2        111  
    4          1        121  
    4          2        117  
    5          1        116  
    5          2        121  
    6          1        109  
    6          2        103  
    7          1        120  
    7          2        111  
    8          1        115  
    8          2        110 
    9          1        117
    9          2        109
    10         1        123
    10         2        114
    11         1        108
    11         2        109
    12         1        121
    12         2        113
    end
    
    anova y a pairid
    
                               Number of obs =      24     R-squared     =  0.7579
                               Root MSE      = 4.61224     Adj R-squared =  0.4938
    
                      Source |  Partial SS    df       MS           F     Prob > F
                  -----------+----------------------------------------------------
                       Model |       732.5    12  61.0416667       2.87     0.0456
                             |
                           a |          96     1          96       4.51     0.0571
                      pairid |       636.5    11  57.8636364       2.72     0.0558
                             |
                    Residual |         234    11  21.2727273   
                  -----------+----------------------------------------------------
                       Total |       966.5    23  42.0217391   
    
    display sqrt(e(F_1))
    
    2.12434
    
    regress y i.a i.pairid
    
          Source |       SS       df       MS              Number of obs =      24
    -------------+------------------------------           F( 12,    11) =    2.87
           Model |       732.5    12  61.0416667           Prob > F      =  0.0456
        Residual |         234    11  21.2727273           R-squared     =  0.7579
    -------------+------------------------------           Adj R-squared =  0.4938
           Total |       966.5    23  42.0217391           Root MSE      =  4.6122
    
    ------------------------------------------------------------------------------
               y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             2.a |         -4   1.882938    -2.12   0.057    -8.144318     .144318
                 |
          pairid |
              2  |         10   4.612237     2.17   0.053    -.1514645    20.15146
              3  |          1   4.612237     0.22   0.832    -9.151465    11.15146
              4  |       14.5   4.612237     3.14   0.009     4.348535    24.65146
              5  |         14   4.612237     3.04   0.011     3.848535    24.15146
              6  |        1.5   4.612237     0.33   0.751    -8.651465    11.65146
              7  |         11   4.612237     2.38   0.036     .8485355    21.15146
              8  |          8   4.612237     1.73   0.111    -2.151465    18.15146
              9  |        8.5   4.612237     1.84   0.092    -1.651465    18.65146
             10  |         14   4.612237     3.04   0.011     3.848535    24.15146
             11  |          4   4.612237     0.87   0.404    -6.151465    14.15146
             12  |       12.5   4.612237     2.71   0.020     2.348535    22.65146
                 |
           _cons |      106.5   3.394514    31.37   0.000     99.02872    113.9713
    ------------------------------------------------------------------------------


    Linear Statistical Models Course

    Phil Ender, 25apr06, 12Feb98