
When researchers want to measure change, the paired sample t-test is one of the most reliable tools in their statistical arsenal. Whether you’re tracking patient blood pressure before and after a medication, comparing student scores before and after a tutoring program, or evaluating employee performance before and after training, this test is built for exactly that structure: two related measurements on the same subjects.
Unlike tests that compare two entirely separate groups, the paired sample t-test accounts for the natural connection between measurements, making it more sensitive to real differences. By focusing on the difference within each pair rather than between groups, it controls for individual variability that would otherwise obscure your results.
Struggling to find time for your assignment?
We write it for you: fast, reliable, and plagiarism-free
A paired sample t-test (also called a dependent samples t-test or repeated measures t-test) is a statistical test used to determine whether the mean difference between two related measurements is significantly different from zero. Rather than comparing two independent groups, it compares two measurements taken from the same subject — or from two subjects who have been deliberately matched on key characteristics.
The test works by computing the difference between each pair of observations, then asking a simple question: is the average of those differences large enough — relative to their variability — to conclude that a real effect exists, rather than random chance?
The Core Idea
Suppose you measure the resting heart rate of 20 participants before and after an eight-week exercise program. Each participant produces two data points: a pre-test score and a post-test score. Instead of treating these as two separate groups of 20, the paired t-test treats them as 20 individual differences:
The test then evaluates whether the mean of those differences (dˉ) is statistically distinguishable from zero.
When Two Measurements Are “Paired”
Pairing occurs in two main research designs:
Repeated measures — The same subject is measured twice, typically before and after an intervention. This is the most common scenario. Examples include pre/post test scores, clinical measurements before and after treatment, or product ratings before and after a design change.
Matched pairs — Two different subjects are paired based on shared characteristics (age, weight, baseline score) to control for confounding variables. For example, pairing twins in a dietary study, or matching patients by severity of illness before assigning treatments.
In both cases, what defines a paired design is the meaningful, intentional link between each pair of observations — not just the fact that two measurements exist.
What the Test Produces
The paired sample t-test generates a t-statistic, which measures how many standard errors the observed mean difference sits away from zero. From the t-statistic, a p-value is derived, telling you the probability of observing a difference as large as yours — or larger — if the null hypothesis were true.
The test also produces a confidence interval for the mean difference, giving you a range of plausible values for the true population effect.
Paired vs. Independent Samples t-Test
A common point of confusion is deciding between a paired and an independent samples t-test. The distinction comes down to the relationship between observations:
| Feature | Paired Samples t-Test | Independent Samples t-Test |
|---|---|---|
| Subjects | Same (or matched) | Different, unrelated groups |
| Data structure | One row per pair | One row per subject |
| Controls for individual variability | Yes | No |
| Typical use case | Pre/post, matched pairs | Group A vs. Group B |
| Statistical power | Higher (when pairing is effective) | Lower for same sample size |
Choosing the wrong test — running an independent samples t-test on paired data — discards the correlation structure between measurements and reduces statistical power, making it harder to detect a real effect.
Assumption 1: Dependent Variable Is Continuous
The outcome variable must be measured on an interval or ratio scale — meaning the values are numeric, ordered, and the distances between them are consistent and meaningful.
This assumption is definitional: if your outcome is ordinal, binary, or categorical, the paired t-test is the wrong test. The mean difference is only interpretable when the underlying scale supports arithmetic operations.
Assumption 2: Observations Are Paired Meaningfully
Each observation in the first measurement must have one — and only one — corresponding observation in the second measurement. The pairing must reflect a genuine structural relationship, either because:
This assumption is about study design, not something you can verify statistically after the fact. If pairings were not built into the data collection process, the paired t-test is not appropriate regardless of how the data are arranged.
Assumption 3: Independence of Pairs
While the two measurements within each pair are intentionally related, the pairs themselves must be independent of one another. The difference score for one subject should have no bearing on the difference score for another.
This assumption is violated when:
Independence is primarily a function of study design and sampling procedure. It cannot be tested statistically in the same way as normality, but it should be addressed in how participants were recruited and how the intervention was delivered.
Assumption 4: Normality of the Differences
The paired t-test requires that the difference scores ( are approximately normally distributed in the population. Importantly, this does not require the raw measurements themselves to be normal — only the differences.
How to assess normality:
Shapiro-Wilk test — The most widely recommended formal test for normality in small to moderate samples. A non-significant result (p > .05) supports the normality assumption.
Histogram of differences — A quick visual check. Look for an approximately bell-shaped distribution without severe skewness or bimodality.
Q-Q plot (quantile-quantile plot) — Plots the quantiles of your difference scores against the theoretical quantiles of a normal distribution. Points falling close to the diagonal line indicate normality. Systematic curves or S-shapes indicate departures.
The paired sample t-test reduces a two-measurement problem to a one-sample problem by working entirely with the difference scores. Once you compute those differences, the test follows the same logic as a one-sample t-test asking whether the mean of a single variable equals zero.
Step 1: Compute the Difference Scores
For each subject i, subtract the first measurement from the second:
Where:
The direction of subtraction is arbitrary but must be consistent across all subjects. Reversing it changes the sign of the t-statistic but not its magnitude or the p-value.
Step 2: Compute the Mean Difference
Calculate the arithmetic mean of the difference scores across all n pairs:
Where:
This is the central quantity the test evaluates. A mean difference of zero would indicate no average change across subjects.
Step 3: Compute the Standard Deviation of the Differences
Measure how much the individual difference scores vary around their mean:
Where:
A larger reflects greater inconsistency in how subjects responded to the intervention. High variability in the differences makes it harder to detect a statistically significant effect.
Step 4: Compute the Standard Error of the Mean Difference
The standard error (SE) quantifies the precision of as an estimate of the true population mean difference:
As sample size increases, the standard error decreases, reflecting the greater reliability of the mean difference estimate with more data.
Step 5: Compute the t-Statistic
Divide the mean difference by its standard error:
The t-statistic expresses how many standard errors the observed mean difference falls from zero. A large absolute value of t—in either direction—indicates that the mean difference is unlikely to have occurred by chance if the null hypothesis were true.
Degrees of Freedom
The paired t-test has degrees of freedom equal to one less than the number of pairs:
The degrees of freedom determine which t-distribution is used to compute the p-value. With smaller samples, the t-distribution has heavier tails, reflecting greater uncertainty. As n increases, the t-distribution converges toward the standard normal distribution.
Hypothesis Testing Framework
The test evaluates one of three possible hypothesis structures, depending on your research question:
| Test Type | Null Hypothesis | Alternative Hypothesis | Use When |
|---|---|---|---|
| Two-tailed | Direction of effect is not predicted in advance | ||
| One-tailed (upper) | Predicting the second measurement will be higher | ||
| One-tailed (lower) | Predicting the second measurement will be lower |
In most research contexts, the two-tailed test is the default choice. One-tailed tests require a strong directional hypothesis stated before data collection and are more susceptible to inflated Type I error if the direction is wrong.
Confidence Interval for the Mean Difference
Alongside the t-statistic and p-value, a confidence interval provides a range of plausible values for the true population mean difference :
Where:
If the confidence interval does not include zero, the mean difference is statistically significant at the corresponding alpha level. The width of the interval reflects the precision of the estimate — narrower intervals arise from larger samples or smaller variability in the differences.
Worked Example: Calculating by Hand
Ten students sat a mathematics test before and after a four-week revision programme. Their scores are recorded below.
| Student | Pre () | Post () | Difference () |
|---|---|---|---|
| 1 | 58 | 65 | 7 |
| 2 | 72 | 74 | 2 |
| 3 | 63 | 71 | 8 |
| 4 | 55 | 60 | 5 |
| 5 | 80 | 79 | −1 |
| 6 | 67 | 75 | 8 |
| 7 | 74 | 80 | 6 |
| 8 | 61 | 68 | 7 |
| 9 | 70 | 72 | 2 |
| 10 | 66 | 73 | 7 |
Mean difference:
Standard deviation of differences:
Standard error:
t-statistic:
Degrees of freedom:
With t(9)=5.25 and a two-tailed test, the p-value is approximately , indicating strong evidence that the revision programme produced a statistically significant improvement in mathematics scores.
Step 1: Confirm Your Data Structure
Before running any calculations, verify that your data meets the structural requirements of the paired t-test.
Check the following:
Step 2: State Your Hypotheses
Define the null and alternative hypotheses before examining the data.
A two-tailed test is used here because, while an improvement is expected, the test does not formally restrict the direction of the effect. The significance level is set at α=.05 prior to analysis.
Step 3: Compute the Difference Scores
For each subject, subtract the pre-test score from the post-test score:
| Student | Pre | Post | di | (di−dˉ)2 |
|---|---|---|---|---|
| 1 | 58 | 65 | 7 | 3.61 |
| 2 | 72 | 74 | 2 | 9.61 |
| 3 | 63 | 71 | 8 | 8.41 |
| 4 | 55 | 60 | 5 | 0.01 |
| 5 | 80 | 79 | −1 | 37.21 |
| 6 | 67 | 75 | 8 | 8.41 |
| 7 | 74 | 80 | 6 | 0.81 |
| 8 | 61 | 68 | 7 | 3.61 |
| 9 | 70 | 72 | 2 | 9.61 |
| 10 | 66 | 73 | 7 | 3.61 |
| Total | 51 | 84.90 |
Step 4: Check the Assumptions
4a. Normality of the differences
With only 10 pairs, the Central Limit Theorem cannot be relied upon. Inspect the differences visually and run a Shapiro-Wilk test.
The difference scores are: −1, 2, 2, 5, 6, 7, 7, 7, 8, 8
These values are slightly left-skewed due to the single negative value but are broadly reasonable for a sample of this size. A Shapiro-Wilk test on these differences yields , , which does not reject normality at . The normality assumption is considered satisfied.
4b. Outliers in the differences
The difference score of for Student 5 is the most unusual value. Computing its z-score:
An absolute z-score of 1.99 is well below the threshold of 3.29 for extreme outliers. No influential outliers are present.
Step 5: Calculate the Test Statistic
Using the values derived in the previous section:
Step 6: Determine the Critical Value and p-Value
For a two-tailed test with df=9 and α=.05, the critical value from the t-distribution is:
Since the observed exceeds the critical value of in absolute terms, the result falls in the rejection region.
The exact two-tailed p-value associated with is
Since , the null hypothesis is rejected.
Step 7: Compute the Confidence Interval
A 95% confidence interval for the mean difference is:
The interval does not include zero, which is consistent with the rejection of the null hypothesis. The true mean improvement in mathematics scores is estimated to lie between 2.90 and 7.30 points.
Step 8: Calculate Effect Size
Statistical significance tells you that an effect exists; effect size tells you how large it is. The standard effect size measure for the paired t-test is Cohen’s d:
Cohen’s d is interpreted using conventional benchmarks:
| Cohen’s d | Interpretation |
|---|---|
| 0.2 | Small effect |
| 0.5 | Medium effect |
| 0.8 | Large effect |
| > 1.0 | Very large effect |
A Cohen’s d of 1.66 indicates a very large effect — the revision programme produced a mean improvement that was substantially larger than the typical variability in difference scores.
Step 9: Interpret and Report the Results
A complete statistical report includes the mean difference, standard deviation of differences, t-statistic, degrees of freedom, p-value, confidence interval, and effect size.
Example write-up:
A paired sample t-test was conducted to evaluate whether the four-week revision programme produced a significant change in mathematics scores. The mean post-test score was significantly higher than the mean pre-test score (dˉ=5.10, sd=3.07), t(9)=5.25, p=.001, 95% CI [2.90, 7.30]. The effect size was very large (d=1.66), indicating that the improvement in scores substantially exceeded the typical variability between students. These results provide strong evidence that the revision programme had a meaningful positive impact on mathematics performance.


R provides the paired t-test through the built-in t.test() function. The paired = TRUE argument is all that distinguishes it from an independent samples test.
Base R:
r
pre <- c(58, 72, 63, 55, 80, 67, 74, 61, 70, 66)
post <- c(65, 74, 71, 60, 79, 75, 80, 68, 72, 73)
result <- t.test(post, pre, paired = TRUE)
print(result)
Output:
Paired t-test
data: post and pre
t = 5.2522, df = 9, p-value = 0.0005151
alternative hypothesis: true mean difference is not equal to 0
95 percent confidence interval:
2.904089 7.295911
sample estimates:
mean of the differences
5.1
Checking assumptions in R:
r
differences <- post - pre
shapiro.test(differences)
hist(differences, main = "Histogram of differences", xlab = "d_i")
qqnorm(differences); qqline(differences)
boxplot(differences, main = "Boxplot of differences")
Effect size using effectsize:
r
install.packages("effectsize")
library(effectsize)
cohens_d(post, pre, paired = TRUE)
Using rstatix for a tidy workflow:
r
install.packages("rstatix")
library(rstatix)
library(tidyr)
df <- data.frame(
student = rep(1:10, 2),
time = rep(c("pre", "post"), each = 10),
score = c(pre, post)
)
df %>% t_test(score ~ time, paired = TRUE, detailed = TRUE)
Using scipy.stats:
python
from scipy import stats
pre = [58, 72, 63, 55, 80, 67, 74, 61, 70, 66]
post = [65, 74, 71, 60, 79, 75, 80, 68, 72, 73]
t_stat, p_value = stats.ttest_rel(post, pre)
print(f"t = {t_stat:.4f}, p = {p_value:.4f}")
# t = 5.2522, p = 0.0005
Confidence interval and effect size manually:
python
import numpy as np
from scipy import stats
differences = np.array(post) - np.array(pre)
n = len(differences)
dbar = np.mean(differences)
sd = np.std(differences, ddof=1)
se = sd / np.sqrt(n)
t_crit = stats.t.ppf(0.975, df=n-1)
ci_lower = dbar - t_crit * se
ci_upper = dbar + t_crit * se
cohens_d = dbar / sd
print(f"Mean difference: {dbar:.2f}")
print(f"95% CI: [{ci_lower:.2f}, {ci_upper:.2f}]")
print(f"Cohen's d: {cohens_d:.2f}")
Using pingouin for a complete output:
python
pip install pingouin
import pingouin as pg
import pandas as pd
df = pd.DataFrame({"pre": pre, "post": post})
result = pg.ttest(df["post"], df["pre"], paired=True)
print(result)
Normality check:
python
stat, p = stats.shapiro(differences)
print(f"Shapiro-Wilk: W = {stat:.3f}, p = {p:.3f}")
SPSS performs the paired t-test through the Analyze menu with no syntax required, though syntax is provided below for reproducibility.
Via the menu:
pre into the Variable 1 slot and post into the Variable 2 slot of Pair 1.SPSS syntax:
spss
T-TEST PAIRS = pre WITH post (PAIRED)
/CRITERIA = CI(.9500)
/MISSING = ANALYSIS.
Checking assumptions in SPSS:
spss
COMPUTE diff = post - pre.
EXECUTE.
EXAMINE VARIABLES = diff
/PLOT BOXPLOT HISTOGRAM NPPLOT
/STATISTICS DESCRIPTIVES
/CINTERVAL 95
/MISSING LISTWISE
/NOTOTAL.
Excel does not have a dedicated paired t-test function, but the test can be run using either the Data Analysis ToolPak or a manual formula approach.
Method 1: Data Analysis ToolPak
0.0.05.Method 2: Formula approach
| Cell | Formula | Purpose |
|---|---|---|
| C2 | =B2-A2 | Difference score for row 2 (copy down to C11) |
| E1 | =AVERAGE(C2:C11) | Mean difference dˉ |
| E2 | =STDEV(C2:C11) | Standard deviation sd |
| E3 | =E2/SQRT(COUNT(C2:C11)) | Standard error SEdˉ |
| E4 | =E1/E3 | t-statistic |
| E5 | =COUNT(C2:C11)-1 | Degrees of freedom |
| E6 | =T.DIST.2T(ABS(E4),E5) | Two-tailed p-value |
| E7 | =E1-T.INV.2T(0.05,E5)*E3 | Lower 95% CI bound |
| E8 | =E1+T.INV.2T(0.05,E5)*E3 | Upper 95% CI bound |