www.seeingstatistics.com

Student's t-test for Paired Groups

The appropriate statistical test is variously called the paired or dependent or within-subjects or within-groups Student t-test. The difference between the paired scores for each case is
difference between two paired scores
These difference scores can then compared against the null hypothesis of zero using the one-sample t-test. An alternative and equivalent formula highlights an important advantage of the paired t-test. With two scores from each of n observations,
paired t-test formula
where
paired standard error for mean difference
where r is the correlation between the two sets of scores. Note that the greater the correlation, the smaller is the standard error of the difference, and hence the smaller is the denominator of the t-test. Thus, larger correlations--greater similarity between the scores for each observation--increases the value of the t-statistic.

The calculated value, whichever method is used, of Student's t is compared to the t-distribution with degrees of freem equal to n - 1.

Example

To evaluate the effectiveness of a computer typing game for improving keyboard skills, 11 third-grade students take a typing test before and after playing the game. To score points in the game, students must correctly type short words to intercept alien invaders on the screen. Scores on the before and after typing test are the number of mistakes made typing matched passages of 30 words.

StudentBeforeAfterDiff
1853
2770
3642
41266
557-2
6422
71073
8990
946-2
10743
111174
Mean7.55.81.7

If playing the typing game had no effect on typing test scores, then we would expect the differences for each student to be zero, on average.

Summary

For 11 third-grade students, the average number of errors on a typing test before playing a computer typing game was 7.5, but after playing the game the average number of errors was 5.8. The reduction of 1.7 errors is statistically significant (t(10) = 2.3, p = .045). Thus, the typing game is effective in improving the keyboard skills of third-grade students.


Computer Examples

R

> before <- c(8,7,6,12,5,4,10,9,4,7,11,7.5)
> after <- c(5,7,4,6,7,2,7,9,6,4,7,5.8)
> mean(before)
[1] 7.541667
> mean(after)
[1] 5.816667
> t.test(after,before,paired=TRUE)

	Paired t-test

data:  after and before 
t = -2.5133, df = 11, p-value = 0.02882
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval:
 -3.2356513 -0.2143487 
sample estimates:
mean of the differences 
                 -1.725 

Alternatively, one may do the one-sample t-test this way:

> t.test(after - before)

	One Sample t-test

data:  after - before 
t = -2.5133, df = 11, p-value = 0.02882
alternative hypothesis: true mean is not equal to 0 
95 percent confidence interval:
 -3.2356513 -0.2143487 
sample estimates:
mean of x 
   -1.725 

#Useful graphs
#boxplot of differences with line indicating 0 change
> boxplot(after - before, main="Typing Errors", ylab='after-before', col='red')
> abline(0,0,col='blue', lwd='2')
Boxplot of change in typing errors

Advanced

#check assumption of normality
> qqnorm(after - before)
> qqline(after - before)
Quantile-quantile plot of difference scores

StatView

Prepare a dataset like this one:

data for paired t-test for StatView
/
paired box plots

paired t in Statview

Excel

Menu: Tools > Data Analysis > T-test: Paird Two-Sample for Means

parited t-test in Excel



© 2002, Gary McClelland