Paired t-test
Means (parametric) · Two paired samples · reference distribution: t(n−1)
When to use it
Compare two measurements taken on the same individuals, such as before and after an intervention.
Null hypothesis
The mean of the differences is zero: μ_d = 0.
Assumptions
- Pairs independent of each other
- Approximately normal differences
Test statistic
t = \dfrac{\bar{d}}{s_d / \sqrt{n}}Effect size
d_z, on the scale of the differences.
d_z = \dfrac{\bar{d}}{s_d}How to report it
t(14) = 3.02, p = .009, d_z = 0.78
In R and Python
R
t.test(after, before, paired = TRUE)
Python
stats.ttest_rel(after, before)
In Python, stats is scipy.stats and np is numpy.
Variants and alternatives
- Wilcoxon signed-rank, without assuming normality
Where it sits in the catalog
Means (parametric). Parametric tests assume a model for the data, usually the normal distribution, and compare its parameters, such as the mean. When the assumption holds, they are the most powerful.
Two paired samples. Two measurements linked in pairs: the same individual before and after, or matched pairs, such as twins. The test uses the difference within each pair.
In the decision tree
- What do you want to do? Compare groups, or one group with a reference value
- What kind of response did you measure? Numeric: a measurement, such as weight, time or score
- How many groups or measurements? Two groups
- Are the groups made of different individuals or the same individuals? The same individuals, such as before and after (paired)
- Are the differences between pairs approximately normal? Yes