In this paper I use R to conduct a t-test on stroop effect.
stroop <- read.csv('stroopdata.csv')
stroop
## Congruent Incongruent
## 1 12.079 19.278
## 2 16.791 18.741
## 3 9.564 21.214
## 4 8.630 15.687
## 5 14.669 22.803
## 6 12.238 20.878
## 7 14.692 24.572
## 8 8.987 17.394
## 9 9.401 20.762
## 10 14.480 26.282
## 11 22.328 24.524
## 12 15.298 18.644
## 13 15.073 17.510
## 14 16.929 20.330
## 15 18.200 35.255
## 16 12.130 22.158
## 17 18.495 25.139
## 18 10.639 20.429
## 19 11.344 17.425
## 20 12.369 34.288
## 21 12.944 23.894
## 22 14.233 17.960
## 23 19.710 22.058
## 24 16.004 21.157
independent variable: Weather the word is the same as the color of the word (Congruent or Incongruent)
dependent variable: time takes to recognize color of words
library(ggplot2)
library(gridExtra)
## Warning: package 'gridExtra' was built under R version 3.1.3
p1 <- ggplot(aes(x=Congruent), data=stroop) + geom_histogram(fill='blue', color='white', binwidth=3)
p2 <- ggplot(aes(x=Incongruent), data=stroop) + geom_histogram(fill='red', color='white', binwidth=4)
grid.arrange(p1, p2)
stroop2 <- rbind(data.frame(time=stroop$Congruent, condition="Congruent"),
data.frame(time=stroop$Incongruent, condition="Incongruent"))
ggplot(aes(x=condition, y=time), data=stroop2) + geom_boxplot()
From histogram of Congruent time and Incongruent time we can see that the data is approximately normally distributed, from box plot we can see that most time in Incongruent group is greater than time in Congruent group.
Congruent.mean <- mean(stroop$Congruent) #14.05113
Incongruent.mean <- mean(stroop$Incongruent) #22.01592
sd.Congruent <- sd(stroop$Congruent) #3.559358
sd.Incongruent <- sd(stroop$Incongruent) #4.797057
Average time of Congruent group is 14.051, and average time of Incongruent group is 22.016, the latter is larger. The deviances are 3.559 and 4.797. The times in Incongruent group vary more.
Because time in both groups is approximately normal, we could conduct z-test or t-test for them, however we only have 24 datasets and we don’t know the population standard error, so z-test would not be appropriate for this dataset, thus I would use t-test. Our data come from 24 participants take two tests, one for congruent condition, another for incongruent condition, so I would use paired sample test. Since I care about whether time need to recognize color in Incongruent group is greater than that in Congruent group, I would use one-tailed test. In summary I would use one-tailed paired sample t-test for this dataset.
\(\mu_1\): average of time population in Congruent group
\(\mu_2\): average of time population in Incongruent group
\(H_0\): Average of time population in Incongruent group is less than or equal to average of time population in Congruent group (\(\mu_2 \leq \mu_1\))
\(H_a\): Average of time population in Incongruent group is greater than average of time population in Congruent group (\(\mu_2 \gt \mu_1\))
n <- dim(stroop)[1] #24
diff <- Incongruent.mean - Congruent.mean #7.964792
s <- sd(stroop$Incongruent - stroop$Congruent) #4.864827
standard.error <- s / sqrt(n) #0.9930286
t.statistic <- diff / standard.error #8.020707
t.critical <- qt(.99, df=n-1) #2.499867
p.value <- 1 - pt(t.statistic, df=n-1) #2.0515e-08
T critical value for \(\alpha = 0.01\) is 2.5, which is smaller than our t statistic value 8.02, so we reject the null hypothesis. We could also decide by looking p value, p value for this test is \(2.05\times10^{-8}\), which is a lot smaller than \(\alpha\). We reject the null hypothesis, thus we accept the alternative hypothesis, that is “Average of time population in Incongruent group is greater than average of time population in Congruent group”. This means that words do help people to recognize color in Congruent group or words do interfere people to recognize color in Incongruent group.
Although we get conclusion “Average of time population in Incongruent group is greater than average of time population in Congruent group”, actually we don’t know weather words help people to recognize color in Congruent group, or interfere people to recognize color in Incongruent group, or both. It would better have a neutral group to help us decide.