Paired t-tests--example.

The following example comes from our course text, page 785. The data are from a study on ESP where each of 15 student subjects is given a 100 "Zener card" test while awake. Pure guessing would be an expected score of 20. Each subject also gets another testing of 100 cards, but hypnotized. To negate any "order effect" the order of waking or hypnotic state is determined at random.

Get into R. Select and 'copy' the data below, including the column names. Then go into R, and type in:

ESP.df <- read.table(file='clipboard',header=T)

OR ... you should just be able to access it from the instructor's file by referring to ESP.df.

Student  Waking   Hypnotic
 1         18         25
 2         19         20
 3         16         26
 4         21         26
 5         16         20
 6         20         23
 7         20         14
 8         14         18
 9         11         18
10         22         20
11         19         22
12         29         27
13         16         19
14         27         27
15         15         21
 

Here is the R code for performing the paired t analysis:
attach(ESP.df)
diff <- Hypnotic-Waking
t.test(diff, alternative="greater")

OUTPUT follows

        One Sample t-test

data:  diff
t = 2.683, df = 14, p-value = 0.00892
alternative hypothesis: true mean is greater than 0
95 percent confidence interval:
 0.9847933       Inf
sample estimates:
mean of x
 2.866667

The results are highly statistically significant (p = .009). We conclude that the hypnotic state improves performance on the ESP task.

NOTE: An alternative method, that obviates the creation of the diff vector is:

t.test(Waking,Hypnotic,paired=TRUE,alternative='less')