Ed230A

Introduction to Research Design and Statistics

Testing Means (t-distribution)


t-test for Dependent Groups (Within-Subjects)

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 called the t-test for repeated measures because it can be used in situations involving collecting 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: μd = 0 H1: μd ≠ 0
  • 1-tail - H0: μd <= 0 H1: μd > 0
  • 1-tail - H0: μd >= 0 H1: μd < 0

    Assumptions

  • Independence
  • Normality

    The Trick to the Dependent t-test

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

    Formulas

  • Standard Deviation for the Differences

  • Dependent t-test

    Degrees of freedom: df = n - 1, where n is the number of pairs of values.

    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 Examples

    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
     
    
    use http://www.gseis.ucla.edu/courses/data/hsb2
      
    generate diff =  write - math
      
    ttest write = math
     
    Paired t test
     
    ------------------------------------------------------------------------------
    Variable |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
    ---------+--------------------------------------------------------------------
       write |     200      52.775    .6702372    9.478586    51.45332    54.09668
        math |     200      52.645    .6624493    9.368448    51.33868    53.95132
    ---------+--------------------------------------------------------------------
        diff |     200         .13    .5828931    8.243353    -1.01944     1.27944
    ------------------------------------------------------------------------------
     
                       Ho: mean(write - math) = mean(diff) = 0
     
      Ha: mean(diff) < 0         Ha: mean(diff) ~= 0        Ha: mean(diff) > 0
           t =   0.2230                t =   0.2230              t =   0.2230
       P < t =   0.5881          P > |t| =   0.8237          P > t =   0.4119
      
    /*  check normality of difference scores  */
      
    kdbox diff, norm mean  /*  findit kdbox  */
      
         
         
    ttest write = math if female==1
     
    Paired t test
      
    ------------------------------------------------------------------------------
    Variable |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
    ---------+--------------------------------------------------------------------
       write |     109    54.99083    .7790686    8.133715    53.44658    56.53507
        math |     109     52.3945    .8765083    9.151015     50.6571    54.13189
    ---------+--------------------------------------------------------------------
        diff |     109     2.59633    .6734012    7.030515    1.261532    3.931128
    ------------------------------------------------------------------------------
      
                       Ho: mean(write - math) = mean(diff) = 0
     
      Ha: mean(diff) < 0         Ha: mean(diff) ~= 0        Ha: mean(diff) > 0
           t =   3.8555                t =   3.8555              t =   3.8555
       P < t =   0.9999          P > |t| =   0.0002          P > t =   0.0001
      
    /*  check normality of difference scores  */
      
    kdbox diff if female==1, norm mean
      
         

    t-test Summary


    UCLA Department of Education

    Phil Ender, 14JNov00