# 6.4: The paired samples t-test strikes back


You must be wondering if we will ever be finished talking about paired samples t-tests… why are we doing round 2, oh no! Don’t worry, we’re just going to 1) remind you about what we were doing with the infant study, and 2) do a paired samples t-test on the entire data set and discuss.

Remember, we were wondering if the infants would look longer toward the singer who sang the familiar song during the test phase compared to the baseline phase. We showed you data from 5 infants, and walked through the computations for the $$t$$-test. As a reminder, it looked like this:

infant Baseline Test differences diff_from_mean Squared_differences
1 0.44 0.6 0.16 0.106 0.011236
2 0.41 0.68 0.27 0.216 0.046656
3 0.75 0.72 -0.03 -0.084 0.00705600000000001
4 0.44 0.28 -0.16 -0.214 0.045796
5 0.47 0.5 0.03 -0.024 0.000575999999999999
Sums 2.51 2.78 0.27 0 0.11132
Means 0.502 0.556 0.054 0 0.022264
sd 0.167
SEM 0.075
t 0.72
library(data.table)
suppressPackageStartupMessages(library(dplyr))
"https://stats.libretexts.org/@api/deki/files/10603/MehrSongSpelke2016.csv")
experiment_one <- all_data %>% filter(exp1==1)
paired_sample_df <-  data.frame(infant=1:5,
Baseline = round(experiment_one$Baseline_Proportion_Gaze_to_Singer[1:5], digits=2), Test = round(experiment_one$Test_Proportion_Gaze_to_Singer[1:5],
digits=2))
paired_sample_df <- cbind(paired_sample_df,
differences = (paired_sample_df$Test- paired_sample_df$Baseline))
paired_sample_df <- paired_sample_df %>%
rbind(c("Sums",colSums(paired_sample_df[1:5,2:4]))) %>%
rbind(c("Means",colMeans(paired_sample_df[1:5,2:4])))

paired_sample_df <-  data.frame(infant=1:5,
Baseline = round(experiment_one$Baseline_Proportion_Gaze_to_Singer[1:5], digits=2), Test = round(experiment_one$Test_Proportion_Gaze_to_Singer[1:5],
digits=2))
differences <-  paired_sample_df$Test-paired_sample_df$Baseline
diff_from_mean <- differences-mean(differences)
Squared_differences <- diff_from_mean^2
paired_sample_df <- cbind(paired_sample_df,
differences, diff_from_mean, Squared_differences)
paired_sample_df <- paired_sample_df %>%
rbind(c("Sums",colSums(paired_sample_df[1:5,2:6]))) %>%
rbind(c("Means",colMeans(paired_sample_df[1:5,2:6]))) %>%
rbind(c(" "," "," "," ","sd ",round(sd(paired_sample_df[1:5,4]),
digits=3))) %>%
rbind(c(" "," "," "," ","SEM ",round(sd(paired_sample_df[1:5,4])/sqrt(5),
digits=3))) %>%
rbind(c(" "," "," "," ","t",mean(differences)/round(
sd(paired_sample_df[1:5,4])/sqrt(5), digits=3))
)
paired_sample_df[6,5]<-0
paired_sample_df[7,5]<-0
t.test(round(differences, digits=2), mu=0)
	One Sample t-test

data:  round(differences, digits = 2)
t = 0.72381, df = 4, p-value = 0.5092
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-0.1531384  0.2611384
sample estimates:
mean of x
0.054


Let’s write down the finding one more time: The mean difference was 0.054, $$t$$(4) = .72, $$p$$ =.509. We can also now confirm, that the $$p$$-value was from a two-tailed test. So, what does this all really mean.

We can say that a $$t$$ value with an absolute of .72 or larger occurs 50.9% of the time. More precisely, the distribution of no differences (the null), will produce a $$t$$ value this large or larger 50.9% of the time. In other words, chance alone good have easily produced the $$t$$ value from our sample, and the mean difference we observed or .054, could easily have been a result of chance.

Let’s quickly put all of the data in the $$t$$-test, and re-run the test using all of the infant subjects.

library(data.table)
suppressPackageStartupMessages(library(dplyr))
"https://stats.libretexts.org/@api/deki/files/10603/MehrSongSpelke2016.csv")
experiment_one <- all_data %>% filter(exp1==1)
paired_sample_df <-  data.frame(infant=1:5,
Baseline = round(experiment_one$Baseline_Proportion_Gaze_to_Singer[1:5], digits=2), Test = round(experiment_one$Test_Proportion_Gaze_to_Singer[1:5],
digits=2))
paired_sample_df <- cbind(paired_sample_df,
differences = (paired_sample_df$Test- paired_sample_df$Baseline))
paired_sample_df <- paired_sample_df %>%
rbind(c("Sums",colSums(paired_sample_df[1:5,2:4]))) %>%
rbind(c("Means",colMeans(paired_sample_df[1:5,2:4])))
paired_sample_df <-  data.frame(infant=1:5,
Baseline = round(experiment_one$Baseline_Proportion_Gaze_to_Singer[1:5], digits=2), Test = round(experiment_one$Test_Proportion_Gaze_to_Singer[1:5],
digits=2))
differences <-  paired_sample_df$Test-paired_sample_df$Baseline
diff_from_mean <- differences-mean(differences)
Squared_differences <- diff_from_mean^2
paired_sample_df <- cbind(paired_sample_df,
differences, diff_from_mean, Squared_differences)
paired_sample_df <- paired_sample_df %>%
rbind(c("Sums",colSums(paired_sample_df[1:5,2:6]))) %>%
rbind(c("Means",colMeans(paired_sample_df[1:5,2:6]))) %>%
rbind(c(" "," "," "," ","sd ",round(sd(paired_sample_df[1:5,4]),
digits=3))) %>%
rbind(c(" "," "," "," ","SEM ",round(sd(paired_sample_df[1:5,4])/sqrt(5),
digits=3))) %>%
rbind(c(" "," "," "," ","t",mean(differences)/round(
sd(paired_sample_df[1:5,4])/sqrt(5), digits=3))
)
paired_sample_df[6,5]<-0
paired_sample_df[7,5]<-0

paired_sample_df <-  data.frame(infant=1:32,
Baseline = round(experiment_one$Baseline_Proportion_Gaze_to_Singer[1:32], digits=2), Test = round(experiment_one$Test_Proportion_Gaze_to_Singer[1:32],
digits=2))
differences <-  paired_sample_df$Test-paired_sample_df$Baseline
t.test(differences,mu=0)
	One Sample t-test

data:  differences
t = 2.4388, df = 31, p-value = 0.02066
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
0.01192088 0.13370412
sample estimates:
mean of x
0.0728125


Now we get a very different answer. We would summarize the results saying the mean difference was .073, t(31) = 2.44, p = 0.020. How many total infants were their? Well the degrees of freedom was 31, so there must have been 32 infants in the study. Now we see a much smaller $$p$$-value. This was also a two-tailed test, so we that observing a $$t$$ value of 2.4 or greater (absolute value) only occurs 2% of the time. In other words, the distribution of no differences will produce the observed t-value very rarely. So, it is unlikely that the observed mean difference of .073 was due to chance (it could have been due to chance, but that is very unlikely). As a result, we can be somewhat confident in concluding that something about seeing and hearing a unfamiliar person sing a familiar song, causes an infant to draw their attention toward the singer, and this potentially benefits social learning on the part of the infant.

This page titled 6.4: The paired samples t-test strikes back is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Matthew J. C. Crump via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.