16 Paired-Samples t-Test
By the end of this chapter you will be able to:
- Choose correctly between paired and independent-samples t-tests.
- Explain what a paired t-test actually tests: the mean of the difference scores.
- Check assumptions on the differences — not the two raw columns.
- Read paired output and report it with Cohen’s d for paired data.
- Identify when a paired t-test is not appropriate (e.g., three or more time points).
Twenty-five students take a memory test, work through your six-week training program, and take the test again. Most improve — but students also differ enormously from each other at baseline, and that person-to-person spread could drown the training effect in an ordinary group comparison. The paired t-test sidesteps the problem with one move: it compares each student to themselves.
The paired-samples t-test compares two measurements taken on the same subjects. The most common case is a pre/post design — the same people measured before and after some intervention. It also applies to matched-pair designs where each subject in one group is matched to a similar subject in the other group.
Mathematically, the paired t-test is a one-sample t-test on the difference scores. Conceptually, by “subtracting out” each subject’s baseline, you remove the between-subject variability and gain statistical power — as long as the two measurements are positively correlated, which they almost always are when the same people are measured twice.
16.1 When to use it
Use a paired t-test when you have:
- One continuous outcome variable.
- Two measurements per subject, or matched pairs.
- An interest in whether the mean difference between the two measurements is zero.
Examples:
- Do students’ test scores improve from pre-test to post-test?
- Does reaction time change between a baseline session and a fatigued session in the same participants?
- Are heart rates different before vs. after a relaxation intervention in the same people?
Use the independent t-test instead if the two groups are different people (treatment vs. control with no matching).

16.2 Hypotheses
- \(H_0\): The mean of the difference scores is zero (\(\mu_d = 0\)).
- \(H_1\): The mean of the difference scores is not zero (\(\mu_d \neq 0\)).
16.3 Assumptions
- Pairs are matched. Each row in your data represents one subject (or one matched pair).
- Independence between pairs. Different subjects are independent of each other; only within a pair is there pairing.
- Continuous outcome. The outcome is interval or ratio.
- Approximate normality of the differences. This is the assumption to check — the differences (post − pre), not the pre and post columns separately. The two columns can each be skewed; only the differences need to be roughly normal.
For a paired t-test, the normality assumption is about the difference scores. Compute the differences first, then run shapiro.test() on them:
diffs <- data$post - data$pre
shapiro.test(diffs)
hist(diffs)Running shapiro.test() on the pre column and post column separately is not the right check — it’s the kind of mistake that shows up routinely in student work.
Before running the formula, try the Rossman/Chance matched pairs applet.
Predict first: look at your difference scores (post − pre). What is the sign of the mean difference, and roughly how large is it? If positive and negative differences were equally likely (the null), how often would you expect a mean difference this extreme? Run the simulation and check.
16.4 R syntax
Two equivalent forms:
# Using two columns directly
t.test(data$post, data$pre, paired = TRUE)
# Or with the difference order reversed (changes sign of t and confidence interval)
t.test(data$pre, data$post, paired = TRUE)The paired = TRUE argument is essential — without it, R will run an independent-samples test, which is wrong for paired data.
16.4.1 Worked example
Twenty-five students take a pre-test, attend training, and then take a post-test. Did scores change?
# Step 0: Load the data (one row per student: pre and post)
data <- read.csv("https://jkoxford-a11y.github.io/awesomesaucestats/data/ch16_pre_post.csv")
# Step 1: Compute differences and inspect
data$diff <- data$post - data$pre
summary(data$diff)
hist(data$diff)
# Step 2: Check normality of differences
shapiro.test(data$diff)
qqnorm(data$diff); qqline(data$diff, col = "red")
# Step 3: Descriptives
mean(data$pre); sd(data$pre)
mean(data$post); sd(data$post)
# Step 4: Run the test
t.test(data$post, data$pre, paired = TRUE)16.4.2 Reading the output
Paired t-test
data: data$post and data$pre
t = 3.136, df = 24, p-value = 0.004483
alternative hypothesis: true mean difference is not equal to 0
95 percent confidence interval:
1.695646 8.224354
sample estimates:
mean difference
4.96
t = 3.136— test statistic.df = 24— degrees of freedom is \(n - 1\), where \(n\) is the number of pairs.p-value = 0.004483— significant.95 percent confidence interval: 1.70 to 8.22— plausible range for the mean difference (post − pre, with the order used above).mean difference: 4.96— average improvement.
Read this output carefully. The R code that produced it is not shown.
Paired t-test
data: data$post and data$pre
t = -1.4508, df = 19, p-value = 0.1631
alternative hypothesis: true mean difference is not equal to 0
95 percent confidence interval:
-5.2517629 0.9517629
sample estimates:
mean difference
-2.15
- What test was run? How many participants (pairs) are in this study?
- What does “mean difference = −2.15” tell you in plain language? Which direction does it go (post higher or pre higher)?
- Is the result statistically significant at α = .05?
- Interpret the 95% confidence interval [−5.25, 0.95]. What does it mean that zero is inside the interval?
- The CI extends to −5.25. What does that tell you about the possible true effect, even though the result is not significant?
- Write one APA 7 sentence. Cohen’s d = −0.32.
- A classmate says “the result is not significant, so there is no effect of the intervention.” What is wrong with this conclusion?
The paired t-test is appropriate when measurements come from the same person (or matched pair) — not simply because two columns of data appear in the same dataset. If a dataset has one column for a treatment group and another for a control group (different participants in each), those are independent groups, not pairs. Running t.test(col1, col2, paired = TRUE) on independent data gives a meaningless result: it subtracts one stranger’s score from another’s, based only on which row they happened to land in.
The test to use is determined by the design — specifically, whether each row represents one person measured twice or two different people. Check this before choosing between paired and independent.
16.5 Effect size: Cohen’s d for paired data
For paired designs, Cohen’s d is the mean of the differences divided by the SD of the differences:
\[ d = \frac{\bar{d}}{s_d} \]
library(effsize)
# within = FALSE returns d_z, matching the formula above exactly
cohen.d(data$post, data$pre, paired = TRUE, within = FALSE)
# Or manually — same result
mean(data$post - data$pre) / sd(data$post - data$pre)effsize’s own default (within = TRUE, i.e. omitting the argument) returns a different, correlation-adjusted standardizer — not \(d_z\). Always pass within = FALSE for the course convention. Yes, FALSE is the right setting for a within-subjects design; that’s a naming quirk of the effsize package, not a statistics idea.
Same interpretation conventions: 0.2 small, 0.5 medium, 0.8 large.
16.6 Reporting
A paired-samples t-test was conducted to compare pre-test and post-test scores; the difference scores showed no evidence of non-normality (Shapiro-Wilk p = .771). There was a significant improvement, t(24) = 3.14, p = .004, Cohen’s d = 0.63 (medium effect), 95% CI for the mean difference [1.70, 8.22]. Pre-test scores (M = 48.60, SD = 6.16) were significantly lower than post-test scores (M = 53.56, SD = 11.40).
16.7 Common mistakes
| Wrong | Right |
|---|---|
t.test(post, pre) — forgot paired = TRUE |
t.test(post, pre, paired = TRUE) |
| Running normality check on pre and post separately | Run it on the differences (post - pre) |
| Using paired test on independent groups | Use independent test (Chapter 15) |
Forgetting that the order of pre and post flips the sign of t |
Pick a convention (usually post − pre) and stick to it |
| Reporting “the mean difference is 4.96” without saying which direction | Always say “post was higher than pre by…” |
Open Paired vs. Independent: What Pairing Buys. Hold the mean pre/post change and both marginal SDs fixed, then increase only the within-person correlation. Watch the paired standard error shrink while the independent-groups calculation cannot use the matching information. A second view deliberately scrambles the row matching to show why two columns alone do not make a paired design.
16.8 Why pairing matters: a worked intuition
The worked example shows it. Run the same 25 students’ scores through an independent-samples test, as if pre and post came from different people:
t.test(data$post, data$pre) # ignores the pairing: p = .063
t.test(data$post, data$pre, paired = TRUE) # uses it: p = .004Same data, same 4.96-point mean gain. The independent test has to judge that gain against the full student-to-student spread in scores (pre SD = 6.16, post SD = 11.40). The paired test judges it against how much the gains vary (SD of the differences = 7.91), because each student’s baseline cancels out. Students with high pre-scores tend to have high post-scores (r = .75), so subtracting removes most of that spread.
Pairing helps only as much as the two measurements are positively correlated. Measure the same people twice and they almost always are.
16.9 Quick reference
| Element | R code |
|---|---|
| Paired t-test | t.test(post, pre, paired = TRUE) |
| One-tailed | t.test(post, pre, paired = TRUE, alternative = "greater") |
| Check normality | shapiro.test(post - pre) |
| Cohen’s d (\(d_z\)) | library(effsize); cohen.d(post, pre, paired = TRUE, within = FALSE) |
| Non-parametric alternative | wilcox.test(post, pre, paired = TRUE) |
| Descriptives | mean(pre); sd(pre); mean(post); sd(post) |
16.10 The same test, different disciplines
The paired t-test applies wherever the same unit is measured twice, or two units are matched before measurement.
| Discipline | Typical comparison | Outcome variable |
|---|---|---|
| Psychology | Same participants before and after an intervention | Anxiety score, cognitive performance, Likert rating |
| Biology | Same organism under two conditions or time points | Heart rate, blood glucose, cortisol level |
| Sociology | Same panel respondents surveyed at two time points | Attitude score, reported income, behavior frequency |
16.11 Three or more measurements: not a paired t-test
A paired t-test handles exactly two measurements per person. With three or more (pre, post, and a follow-up, say), don’t run a paired t-test on each pair of time points: every extra test adds another chance of a false positive, the same problem as running separate t-tests on three groups (Chapter 15). Use a repeated-measures ANOVA instead (Chapter 19), which tests all the time points at once.
Next: three or more groups, with ANOVA.
Core idea: The paired t-test compares two scores from the same participants (or matched pairs). By subtracting each person’s baseline, it removes between-person variability and is typically much more powerful than an independent t-test for the same data.
You should understand:
- What makes observations “paired” (same person twice, or matched pairs)
- Why you check normality of the differences (post − pre), not of the pre and post scores separately
- Why pairing increases statistical power
You should be able to do in R:
- Run the test:
t.test(post, pre, paired = TRUE) - Check normality:
shapiro.test(post - pre) - Effect size:
cohen.d(post, pre, paired = TRUE, within = FALSE)
Plain-language check: A study measures cortisol before and after a stressful task in the same 25 participants. Why would a paired t-test be more appropriate than an independent t-test here?
The one mistake to avoid: Forgetting paired = TRUE. t.test(post, pre) without that argument runs an independent-samples test on paired data, inflating the error variance and reducing power.
Practice: Pre scores: 45, 50, 38, 62, 55. Post scores: 52, 58, 41, 70, 60. Without R: compute the five differences and their mean. What direction would you expect the test to go?
Key terms from this chapter are defined in the Glossary.
Practice all three t-test types together: In-Class Worksheet — Dataset A and Homework — Dataset B.