How to run a paired t test
- Copy the before and after columns so that each item is on the same row.
- Select before as the value 1 column and after as the value 2 column. The difference is calculated as 'after - before', so check the order.
- Press Analyze and check the mean difference, the p-value and, in the before-after chart, how many pairs increased or decreased.
Worked example with sample data
The sample data are the times (seconds) 12 operators needed for the same task before and after a work method improvement. Each row is one operator; before is used as value 1 and after as value 2.
The mean difference (after - before) is -3.317 s, so the task time dropped by 3.3 s on average. With a standard deviation of the differences of 2.643, t = -4.347 (11 degrees of freedom) and the p-value is 0.001161, so the improvement is significant.
In the before-after chart, 11 of the 12 lines slope downward and only one operator got slower (+2.0 s). The 95% confidence interval of the mean difference, -4.996 to -1.637 s, does not contain 0 either.
Ignoring the pairing and analyzing the same data with a 2-sample (Welch) t test gives a p-value of 0.05344 - not significant. The skill differences between operators (57.4 to 67.8 s before the change) hide the improvement, which is why before/after data must be analyzed with the paired t test.
How it is calculated
For each row the difference d = after - before is calculated (rows where either value is blank are skipped), then a 1-sample t test with n-1 degrees of freedom checks whether the mean of d equals the reference difference. The result is the same as SciPy's ttest_rel.
Bland-Altman plot
The x axis is the mean of the two measurements and the y axis is their difference. The solid middle line is the mean difference (bias) and the dashed lines are the limits of agreement at the mean ± 1.96 standard deviations - useful for comparing two measurement methods or seeing whether the change depends on the size of the value.
Difference from the 2-sample t test
Analyzing the same data with a 2-sample t test mixes the item-to-item variation into the error and inflates the p-value. Paired data should be analyzed with the paired t test to see the effect properly.
How to read the paired t test result
- A significant result means the before-after difference is statistically meaningful. Check the sign of the mean difference to see whether it is an increase or a decrease (a negative after - before is a decrease).
- If most lines in the before-after chart slope the same way, the improvement appeared evenly across the items.
- If the QQ plot of the differences shows clear non-normality, also check with the Wilcoxon signed-rank test.
Frequently asked questions
Is it the same as Excel's T.TEST type 1?
Yes. Excel's T.TEST(before, after, 2, 1) is the two-sided paired t test p-value and matches the result here.
What happens to rows that do not pair up?
Rows where either value is blank or not a number are dropped entirely; only complete pairs are used.
Can I reverse the direction of the difference?
Swap the value 1 and value 2 columns and the difference becomes 'before - after' with only the sign reversed. The two-sided p-value stays the same.