Paired data: interval and test for a mean difference
Ten swimmers each swim 100 meters once in each of two swimsuits. The swimmers differ from one another by many seconds, while a swimsuit might change a time by less than one. How can the twenty times show what the suit does?
Where you are 7 in Inference for means
Why this exists
A swim club in Athens wants to know whether a new tech swimsuit makes its swimmers faster over 100 meters than the club’s standard suit (every number in this lesson is made-up data). Katerina, the head coach, has ten swimmers each swim 100 meters twice, once in each suit, with a long rest between. For each swimmer a coin decides which suit comes first, so tiredness or warm-up on the second swim cannot always favor the same suit. This is the matched pairs design of Blocking: randomized block and matched pairs designs, where each delivery van carried both kinds of tire: here each swimmer is a block of two swims.
The fastest swimmer finishes in about 57 seconds and the slowest in about 76, while a suit might change a time by a fraction of a second. Compared as two groups, any suit effect is buried under the gap between swimmers. But each swimmer’s two times belong together, and the change from one to the other is measured against that same swimmer. Analyzing those changes is what makes a small effect visible.
Part 1 (day 1) defines paired data, reduces the pairs to one column of differences, and runs the one-sample t procedures on it. Part 2 (day 2) analyzes the same times wrongly, as two independent samples, to show what pairing buys and why, and settles how to tell from a design which procedure fits.
Definition
Two sets of measurements are paired when each measurement in one set belongs with exactly one measurement in the other, through the way the data were collected: two measurements on the same individual (one swimmer in two suits, a score before and after), or one on each member of a matched pair (two swimmers matched by best time, one assigned to each treatment at random).
Each pair is reduced to its difference d, taken in the same order for every pair. Here
so a positive d means that swimmer was faster in the tech suit. The n differences are one sample of one quantitative variable, with mean \bar{x}_d and standard deviation s_d. The parameter \mu_d is the true mean difference: here, the mean number of seconds by which swimmers like these are faster in the tech suit.
The analysis is then one-sample inference for a mean, applied to the differences: the one-sample t interval, which estimated mean llama fleece weight, and the one-sample t test, which tested mean rice yield against a long-run value, with the conditions of Conditions for one mean checked on the differences.
Intuition
Figure 1 draws each swimmer as a line from the standard-suit time on the left to the tech-suit time on the right.
Down either axis the times spread over almost 20 seconds: that is how much the swimmers differ. Along each line the change is under two seconds, and most lines tilt down toward the tech suit. A difference keeps the tilt of a line and discards its height. The height is the swimmer’s own speed, which the study is not about; the tilt is what the suit did for that swimmer. Figure 2 shows the ten tilts as one column.
Eight of the ten differences are at or above 0, clustered within about a second. Against that spread, a mean of 0.6 seconds stands out; against the 20-second spread of Figure 1, it would not.
Results
For n pairs whose differences have mean \bar{x}_d and standard deviation s_d:
Paired t interval, with t^* the critical value for confidence level C and n - 1 degrees of freedom:
Paired t test of H_0\colon \mu_d = \mu_0 (almost always \mu_0 = 0):
Conditions, on the differences. Random: the pairs are a random sample, or the treatments were randomly assigned within each pair. 10%: when pairs are sampled without replacement, n is under 10\% of all pairs; a randomized experiment that did not sample skips this, and its conclusions reach individuals like those studied. Normal or large sample: with n under 30, a plot of the differences shows no strong skew and no outliers.
Links to the two columns, with means \bar{x}_1, \bar{x}_2, standard deviations s_1, s_2 and correlation r:
Why it is true
The differences are one number per swimmer, and separate swimmers’ results do not depend on one another. So d_1, \dots, d_n are n independent observations of one variable, and everything proved for a single sample mean holds for \bar{x}_d, including the The t distribution and degrees of freedom with n - 1 degrees of freedom. The two times inside a pair are not independent, and the method never needs them to be: that dependence disappears when each pair becomes one number.
A sum of differences splits into a difference of sums, so dividing \sum (x_{1i} - x_{2i}) by n gives \bar{x}_d = \bar{x}_1 - \bar{x}_2. Each deviation splits the same way, d_i - \bar{x}_d = (x_{1i} - \bar{x}_1) - (x_{2i} - \bar{x}_2), and squaring and adding gives
Dividing by n - 1 turns the first two sums into s_1^2 and s_2^2 and, by the definition of correlation, the last into 2 r s_1 s_2. This is the variance of a difference from Combining random variables with the term that independence sets to zero kept in. When the columns rise and fall together, r is near 1 and that term cancels most of s_1^2 + s_2^2.
Worked examples
Examples 1 to 4 are Part 1: recognizing paired data and the interval and test on the differences. Examples 5 to 7 are Part 2: the same times as two samples, calculator output, and choosing the procedure from the design.
Day 1: which designs give paired data
The club considers three ways to compare the suits. Which give paired data? (a) Katerina’s: each of 10 swimmers swims once in each suit, the order decided by a coin. (b) Panos, an assistant coach, assigns 20 swimmers at random, 10 to each suit, and each swims once. (c) Sotiris, the club’s statistician, ranks 20 swimmers by best time and pairs them off, first with second, third with fourth, and so on; in each pair a coin decides who wears the tech suit.
SolutionAsk whether each time in one suit belongs with one particular time in the other.
(a) Paired. Each swimmer’s two times come from the same body, so the difference compares the suits with that swimmer’s speed held fixed.
(b) Not paired. No tech-suit time belongs with any particular standard-suit time; the groups could be listed in any order, and equal group sizes do not create pairs. This design calls for the two-sample t procedures.
(c) Paired. The pairs are formed before treatment by matching on best time, which is closely related to the response, and the coin assigns treatments within each pair. Each difference compares two swimmers of nearly equal speed.
Day 1: a paired t interval for the suit effect
Katerina’s results, in seconds, are in the table. Check the conditions and build a 95\% interval for \mu_d.
| Swimmer | Standard | Tech | d |
|---|---|---|---|
| 1 | 61.2 | 59.7 | 1.5 |
| 2 | 66.8 | 67.2 | -0.4 |
| 3 | 58.4 | 57.5 | 0.9 |
| 4 | 72.5 | 72.2 | 0.3 |
| 5 | 64.1 | 62.9 | 1.2 |
| 6 | 69.3 | 69.3 | 0.0 |
| 7 | 75.6 | 74.0 | 1.6 |
| 8 | 62.7 | 62.1 | 0.6 |
| 9 | 70.4 | 70.6 | -0.2 |
| 10 | 67.9 | 67.4 | 0.5 |
The parameter is \mu_d, the true mean of (standard-suit time minus tech-suit time), in seconds, for swimmers like these ten.
Conditions, on the differences. Random: the order of the two swims was randomized for each swimmer, so this is a randomized experiment. No one was sampled from a larger population, so the 10\% condition does not apply, and the conclusion is about swimmers like these. Normal: with n = 10 a plot is needed, and Figure 2 shows no outliers and no strong skew.
The differences add to 6.0, so \bar{x}_d = 0.6 seconds, and s_d \approx 0.6960 seconds. Then
For 95\% confidence, t^* = 2.262, so the margin of error is 2.262 \times 0.2201 \approx 0.498:
We are 95\% confident that, for swimmers like these, the tech suit lowers the mean 100 meter time by between about 0.10 and 1.10 seconds. Because the order was randomized, the suit can take the credit, and since the whole interval is above 0, no difference on average is not plausible.
Day 1: the paired t test on the same data
Is there convincing evidence at \alpha = 0.05 that the mean time differs between the suits? Katerina had not said in advance which suit she expected to be faster.
SolutionWith \mu_d as in Example 2 and no direction named in advance,
The conditions were checked in Example 2.
Both tails count. In the row for 9 degrees of freedom, 2.262 has one-tail area 0.025 and 2.821 has 0.01, so the two-sided p-value lies between 0.02 and 0.05. Technology, 2 \times `tcdf(2.726, 10^99, 9)`, gives about 0.023.
Since 0.023 \le 0.05, reject H_0. If the suits gave the same mean time, a mean difference at least 0.6 seconds from 0 would arise in only about 2.3\% of randomizations. There is convincing evidence that the mean 100 meter time differs between the suits for swimmers like these, and the data point to the tech suit being faster. This matches Example 2: 0 lies outside the 95\% interval exactly when the two-sided test rejects at 0.05.
Day 1: a one-sided test that fails to reject
Sotiris asks whether a long warm-up (1{,}500 meters) gives faster 100 meter times than a short one (600 meters). Each of 14 swimmers swims after each warm-up, on two days, in random order. With d = short-warm-up time - long-warm-up time, \bar{x}_d = 0.35 seconds and s_d = 0.80 seconds, and the differences show no outliers and no strong skew. He suspected in advance that the long warm-up helps. Test at \alpha = 0.05.
SolutionLet \mu_d be the true mean of (short minus long) times, in seconds, for swimmers like these. A helpful long warm-up makes d positive, so H_0\colon \mu_d = 0 and H_a\colon \mu_d > 0. The order was randomized, nobody was sampled, and the differences look roughly normal.
In the row for 13 degrees of freedom, 1.350 has upper-tail area 0.10 and 1.771 has 0.05, so the p-value is between 0.05 and 0.10; technology gives about 0.063. Since 0.063 > 0.05, fail to reject H_0: these data do not give convincing evidence that the long warm-up lowers the mean time. That is not evidence the warm-ups are equal; fourteen swimmers may be too few to detect an effect this size.
Day 2: the same times as two independent samples
Analyze Katerina’s twenty times from Example 2 as if they were two independent samples, with the two-sample t test of H_a\colon \mu_S \neq \mu_T, and compare with Example 3.
SolutionThe columns have \bar{x}_S = 66.89, s_S \approx 5.336 and \bar{x}_T = 66.29, s_T \approx 5.516 seconds, ten times each. The numerator is the same, 66.89 - 66.29 = 0.6, since the mean of the differences is the difference of the means. The standard error is not:
With technology’s degrees of freedom, about 17.98, the two-sided p-value is about 0.81, and the 95\% interval for \mu_S - \mu_T is about (-4.50,\ 5.70) seconds. This analysis finds no evidence of a suit effect at all, and Figure 3 shows why it looks that way.
The two analyses share the estimate 0.6 but differ by a factor of about 11 in standard error. The two-sample standard error measures how much a mean of ten different swimmers wobbles, and the swimmers differ by many seconds. That variation is the same in both columns, because the same swimmers appear in both, and the differences cancel it: a fast swimmer is fast in either suit.
The Results identity shows the cancellation. Each swimmer’s two times are close, so the columns are almost perfectly correlated, r \approx 0.992, and
The term 2 r s_S s_T removes all but about 0.48 of the 58.90. The two-sample formula adds the variances as if the columns were independent, and here they are far from it. So the two-sample analysis of paired data is not merely weaker: its standard error is wrong, because its independence condition fails.
Day 2: reading TTest output on a list of differences
Panos tests whether a breathing routine before a race changes 50 meter freestyle times. Each of 8 swimmers swims once with it and once without, in random order. In swimmer order, L1 is 29.8, 32.4, 27.6, 34.1, 30.9, 28.7, 33.5, 31.2 (without) and L2 is 29.5, 32.0, 27.8, 33.6, 30.4, 28.6, 33.3, 30.6 (with). He stores L3 = L1 - L2 and runs TTest on L3 with \mu_0 = 0 and \mu \neq \mu_0. Read the screen and conclude at \alpha = 0.05.
| Screen line | What it is |
|---|---|
| \mu \neq 0 | the alternative, H_a\colon \mu_d \neq 0 |
| t = 3.24037 | the paired t statistic |
| p = .014246 | the two-sided p-value |
| \bar{x} = .3 | the mean difference \bar{x}_d, in seconds |
| \text{Sx} = .261861 | the standard deviation of the differences s_d |
| n = 8 | the number of pairs |
A paired test is a one-sample TTest on the differences, so the screen’s \bar{x} and \text{Sx} are \bar{x}_d and s_d, and \mu_d is the true mean of (time without minus time with the routine). L3 holds 0.3, 0.4, -0.2, 0.5, 0.5, 0.1, 0.2, 0.6, with no outliers or strong skew, and the order was random; the calculator checks none of this.
By hand, \displaystyle \text{SE}_{\bar{x}_d} = 0.261861/\sqrt{8} \approx 0.0926 and t = 0.3/0.0926 \approx 3.24 with \text{df} = 7, as on the screen. Since 0.0142 \le 0.05, reject H_0: there is convincing evidence that the routine changes the mean 50 meter time, and the data point to faster times with it, by about 0.3 seconds on average.
Running 2-SampTTest on L1 and L2 would give t \approx 0.27 and a p-value of about 0.79, the mistake of Example 5. The calculator cannot know the lists are paired; only the design says so.
Day 2: choosing the procedure from the design
Paired or two-sample? (a) Katerina times 12 swimmers at the start of the season and again at the end. (b) Panos compares random samples of 15 swimmers from the Athens club and 15 from a club in Thessaloniki. (c) Sotiris assigns 24 swimmers at random, 12 to each suit, then lines the groups up by best time to take differences. (d) Each of 16 swimmers swims 50 meters with a left-arm-only drill and with a right-arm-only drill, in random order.
SolutionThe pairing must come from how the data were collected.
(a) Paired: the same swimmer twice. The interval estimates the mean change over the season, but with no comparison group and no randomization it cannot credit any one cause.
(b) Two-sample: nothing links a particular Athens swimmer to a particular Thessaloniki swimmer.
(c) Two-sample. The assignment was not made within matched pairs, so lining the groups up afterward invents a link the randomization never used. Matching before assigning, as in Example 1(c), would have made it paired.
(d) Paired: two measurements on each swimmer, order randomized.
Boundaries
- The pairing must come from the design. Two independent groups of equal size are not paired, and pairing them after the fact is not legitimate.
- The differences are taken in one order for every pair, and \mu_d is stated with that order, since it sets the sign of \bar{x}_d and the direction of H_a.
- The conditions are checked on the differences. The two original columns may be skewed or have gaps without harming the analysis.
- The degrees of freedom are n - 1 with n the number of pairs, not the number of measurements.
- Before-and-after data on the same people are paired, but without randomization or a comparison group the difference cannot be credited to one cause.
- Pairing removes variation only when the two measurements in a pair are positively correlated. Otherwise it gains nothing and costs degrees of freedom; a paired design is still analyzed as paired.
- The test is about the mean difference. It does not say every swimmer was faster in the tech suit; three of Katerina’s ten were not (two were slower and one tied).
Where this goes next
The matched pairs design of Blocking: randomized block and matched pairs designs earns its precision only when the analysis uses the differences. Two independent groups go to Interval for a difference of means and Test for a difference of means. Deciding which procedure a study calls for, among all the methods for means and proportions, is Choosing the right procedure.
Exercises
All data are made up. Find p-values with technology unless a table is asked for.
Part 1: paired or not
- Paired or not? (a) Resting heart rates of 12 swimmers in September and again in June. (b) The 200 meter times of 15 swimmers from each of two clubs. (c) The grip strength of each swimmer’s left and right hands. (d) Twenty swimmers matched in pairs by age and best time, one in each pair assigned at random to a new kick drill.
Part 1: interval and test on the differences
- For the data of Example 2, a colleague defines d as tech-suit time minus standard-suit time. Find the new \bar{x}_d, s_d, 95\% interval, t and two-sided p-value, and say what changed.
- Six swimmers do as many pull-ups as they can before and after an eight-week strength program. Before: 8, 5, 11, 7, 9, 6. After: 10, 6, 14, 7, 12, 9, in the same order. Find the differences (after minus before), \bar{x}_d and s_d, and a 95\% interval for \mu_d (t^* = 2.571 for \text{df} = 5). The differences show no outliers.
- Twenty-five swimmers each do flip turns with their old technique and a new one, in random order, timed from 5 meters before the wall to 5 meters after. With d = old - new, \bar{x}_d = 0.12 seconds and s_d = 0.25 seconds. Test at \alpha = 0.05 whether the new technique is faster on average.
- Sixteen swimmers swim 200 meters on two days, followed once by a cool-down swim and once by rest, in random order; the response is heart rate five minutes later. With d = cool-down - rest, \bar{x}_d = -1.8 beats per minute and s_d = 3.2, no outliers. Build a 90\% interval for \mu_d (t^* = 1.753 for \text{df} = 15) and interpret it.
- Which conditions are met? (a) Nine pairs whose differences include one far from the rest. (b) Thirty-five pairs whose differences are moderately skewed with no extreme outliers. (c) Twelve pairs from a randomized-order design whose two columns are each strongly skewed but whose differences are roughly symmetric.
- A 95\% paired interval for the mean difference in 50 meter time between two kinds of goggles is (-0.35,\ 0.80) seconds. Does a two-sided test of H_0\colon \mu_d = 0 at \alpha = 0.05 on the same data reject?
- Panos writes the hypotheses of Example 3 as H_0\colon \bar{x}_d = 0, H_a\colon \bar{x}_d \neq 0. What is wrong? Write them correctly, with \mu_d defined in context.
Part 2: paired against two-sample
- Twelve swimmers each swim in two suits in random order. The standard-suit times have s_1 = 6.1 seconds, the tech-suit times s_2 = 6.0 seconds, and the differences s_d = 0.9 seconds; the mean difference is 0.7 seconds. Find the paired t and its two-sided p-value, then the t a two-sample analysis would give.
- For exercise 9, use s_d^2 = s_1^2 + s_2^2 - 2 r s_1 s_2 to find the correlation r between the columns.
- Paired or two-sample? (a) 30 swimmers assigned at random to two training plans, 15 each. (b) Each of 30 swimmers’ times in heats and in finals at one meet. (c) Swimmers’ times compared with their coaches’ times from twenty years earlier, one coach per swimmer.
- Sotiris has 11 swimmers who trained on plan A and 14 on plan B. Panos suggests pairing them for the more powerful paired test. Why is that not possible, and what design would allow it?
Part 2: technology
- Each of 18 swimmers swims 50 meters with a grab start and with a track start, in random order, and Sotiris runs TTest on the differences (grab minus track). The screen reads \mu > 0, t = 1.875694, p = .038989, \bar{x} = .42, \text{Sx} = .95, n = 18. State the hypotheses, recompute the standard error and t, give the degrees of freedom, and decide at \alpha = 0.05 and \alpha = 0.01.
- The six differences of exercise 3 are run through TTest with \mu_0 = 0 and \mu \neq \mu_0. What t, degrees of freedom and p-value does the screen show?
Reasoning
- Katerina’s study has 20 times. Explain why the paired procedures use 9 degrees of freedom, not 18.
- Explain why pairing helps most when individuals differ a great deal, and little if each swimmer’s two times were unrelated.
- Explain why Katerina randomized which suit each swimmer wore first instead of always starting with the standard suit.
- Explain why the normal condition is checked on the differences, not on each column.
- Prove that the mean of the differences equals the difference of the column means, and say what this means for the paired and two-sample statistics.
Answers
- (a) Paired, same swimmer twice. (b) Not paired. (c) Paired, two hands of one swimmer. (d) Paired, matched before random assignment.
- \bar{x}_d = -0.6, s_d \approx 0.6960, interval (-1.098,\ -0.102), t \approx -2.73, p-value about 0.023. Every difference changes sign, so the mean, the interval and t flip sign; the spread, the p-value and the conclusion do not.
- Differences 2, 1, 3, 0, 3, 3; \bar{x}_d = 2, s_d \approx 1.265, \text{SE}_{\bar{x}_d} \approx 0.5164. Interval 2 \pm 2.571 \times 0.5164 \approx (0.672,\ 3.328) pull-ups: the mean gain is plausibly about 0.7 to 3.3, though with no comparison group the program cannot be credited alone.
- H_0\colon \mu_d = 0, H_a\colon \mu_d > 0, \mu_d the true mean of (old minus new) turn times. \displaystyle \text{SE}_{\bar{x}_d} = 0.25/\sqrt{25} = 0.05; t = 0.12/0.05 = 2.4, \text{df} = 24; p-value about 0.012. Reject: convincing evidence the new technique is faster on average.
- \displaystyle \text{SE}_{\bar{x}_d} = 3.2/\sqrt{16} = 0.8; -1.8 \pm 1.753 \times 0.8 \approx (-3.202,\ -0.398). We are 90\% confident a cool-down lowers mean heart rate five minutes later by between about 0.4 and 3.2 beats per minute.
- (a) Normal condition fails: an outlier among only 9 differences. (b) Met: n \ge 30, so moderate skew is fine. (c) Met: only the differences matter.
- No: 0 lies inside the interval, so the test fails to reject.
- Hypotheses are about a parameter; \bar{x}_d = 0.6 is already known. Correct: H_0\colon \mu_d = 0, H_a\colon \mu_d \neq 0, \mu_d the true mean of (standard minus tech) 100 meter times, in seconds, for swimmers like these.
- Paired: \displaystyle \text{SE} = 0.9/\sqrt{12} \approx 0.2598, t \approx 2.69, \text{df} = 11, p-value about 0.021. Two-sample: \displaystyle \text{SE} = \sqrt{6.1^2/12 + 6.0^2/12}, which is \approx 2.470, and t \approx 0.28.
- 0.81 = 37.21 + 36 - 2r(6.1)(6.0), so r = 72.4/73.2 \approx 0.989.
- (a) Two-sample. (b) Paired, same swimmer. (c) Paired, each swimmer linked to one coach, though nothing was assigned, so the result only describes.
- Each plan A swimmer would have to belong with exactly one plan B swimmer, and with 11 and 14 chosen separately there is no such link. Matching swimmers in pairs before a coin assigns the plans, or having each swimmer try both plans in random order, would allow it.
- H_0\colon \mu_d = 0, H_a\colon \mu_d > 0, \mu_d the true mean of (grab minus track) 50 meter times, so positive means the track start is faster. \displaystyle \text{SE}_{\bar{x}_d} = 0.95/\sqrt{18} \approx 0.2239; t \approx 1.876; \text{df} = 17. Reject at 0.05 (0.039 \le 0.05); fail to reject at 0.01.
- t = 2/0.5164 \approx 3.873, \text{df} = 5, p-value about 0.012.
- The analysis uses one difference per swimmer, 10 observations, so \text{df} = 10 - 1 = 9. The 20 times are not 20 independent observations; each swimmer’s two are linked.
- Differences remove whatever is constant within a swimmer, so the larger the spread between swimmers, the more pairing removes; in the identity, that is a large positive r. With unrelated times, r \approx 0, s_d^2 \approx s_1^2 + s_2^2, and nothing is gained.
- A second swim may be faster from warm-up or slower from tiredness. With a fixed order, that effect would sit inside every difference, mixed with the suit effect. Randomizing balances it by chance and supplies the random condition.
- The statistic is built from \bar{x}_d and s_d alone, so its behavior depends on the shape of the differences. The columns’ shapes mostly reflect how the swimmers differ from one another.
- A sum of differences splits: \sum (x_{1i} - x_{2i}) equals \sum x_{1i} - \sum x_{2i}. Dividing both by n gives \bar{x}_d = \bar{x}_1 - \bar{x}_2. So both statistics have the same numerator and differ only in the standard error.