Dependent samples t-test

Dependent samples t-test

Working Directory

setwd("/Volumes/EDMS451/Software Instructions")

Manually Enter Data

dat <- data.frame(test1 = c(4.1, 5.2, 7.5, 8.2, 9.3, 3.1, 1.6,
                            6.0, 7.4, 6.5, 5.1, 9.6, 2.8, 5.9),
                  test2 = c(5.1, 1.2, 2.5, 5.4, 7.7, 2.9, 3.0,
                            2.3, 3.4, 3.5, 2.7, 3.4, 4.8, 3.1))
colnames(dat) <- c("June1234", "July1234")   # change the variable name

dat                           # view the data
   June1234 July1234
1       4.1      5.1
2       5.2      1.2
3       7.5      2.5
4       8.2      5.4
5       9.3      7.7
6       3.1      2.9
7       1.6      3.0
8       6.0      2.3
9       7.4      3.4
10      6.5      3.5
11      5.1      2.7
12      9.6      3.4
13      2.8      4.8
14      5.9      3.1

Check the mean difference

diff_score <- dat$July1234 - dat$June1234
mean(diff_score)
[1] -2.235714
sd(diff_score)
[1] 2.467514

Dependent sample t-test

t.test(Pair(dat$July1234, dat$June1234) ~ 1, alternative = "two.sided", conf.level = 0.99)

    Paired t-test

data:  Pair(dat$July1234, dat$June1234)
t = -3.3902, df = 13, p-value = 0.004833
alternative hypothesis: true difference in means is not equal to 0
99 percent confidence interval:
 -4.222223 -0.249206
sample estimates:
mean of the differences 
              -2.235714