For $n$ pairs, the paired $t$-test is the one-sample $t$-test on the within-pair differences: $t = (\bar{d} - \delta)/(s_d/\sqrt{n})$ on $n - 1$ degrees of freedom, exact when the differences are normal. Its gain comes from the identity $\operatorname{Var}(D) = \sigma_1^2 + \sigma_2^2 - 2\rho\sigma_1\sigma_2$. On Student's ten sleep patients ($r = 0.80$) it gives $t = 4.062$, $p = 0.0028$ and a 95% interval of 0.70 to 2.46 hours; ignoring the pairing gives $p = 0.079$ and an interval that includes zero. On 4,782 NHANES adults' repeated blood pressure readings ($\rho = 0.96$), the unpaired test never rejected in simulation, while the paired test reached power 0.797 with 400 adults. Pairing loses only when the correlation is near zero: below about 0.11 for ten pairs.
Ten patients in a trial of two sleeping drugs each took both drugs, on different nights, and slept on average 1.58 hours more on the second. Confidence Intervals for a Mean and Hypothesis Tests for a Mean treated the ten differences as one sample. They found a 95% interval of 0.70 to 2.46 hours and a two-sided $p$-value of 0.0028. Now analyze the same twenty numbers as if they came from twenty different patients, ten on each drug. The answer becomes $p = 0.079$, with an interval that includes zero. Why should the way a study was run change the analysis of the very same numbers? Because the design decides which variation enters the comparison. Each patient took both drugs, so whatever makes one patient a better sleeper than another cancels from that patient's difference. An analysis that treats the columns as unrelated groups puts that variation back.
The trial was run by Cushny and Peebles (1905), and Student (1908) used its data. Senn and Richardson (1994) discuss its design and how its data were later quoted. A design like this one, where each observation in one sample belongs with exactly one observation in the other, calls for the paired samples $t$-test. It is the one-sample $t$-test applied to the within-pair differences. The gap between $p = 0.0028$ and $p = 0.079$ is not a technicality. It is the difference between using the design of a study and ignoring it.
Here is the route. First we define paired and independent designs. Then the variance of a difference shows where the gain from pairing comes from. Next we set out the paired $t$-test in the notation of the course text (Pagano, Gauvreau and Mattie, 2022), and see what ignoring the pairing does. A large-scale check on repeated blood pressure readings from NHANES follows. Then we find the one situation in which pairing loses. Worked problems close the article. The article assumes the one-sample $t$-test of Hypothesis Tests for a Mean.
Paired and independent designs
Two samples are paired when each observation in one sample corresponds to exactly one observation in the other. The two members of a pair share something that the other observations do not. The NIST/SEMATECH e-Handbook of Statistical Methods (§1.3.5.3) describes this as a one-to-one correspondence between the values in the two samples. Pairs arise in two ways.
- Self-pairing. The same subject is measured twice. Examples are before and after a treatment, under each of two treatments in a crossover trial (the sleep trial), with each of two instruments, or on the left and right eye. Each subject serves as their own comparison.
- Matching. Different subjects are deliberately paired so that the two members are alike in characteristics that affect the outcome, such as age and sex. One member of each pair receives each treatment. Twins are the extreme case.
Two samples are independent when there is no such correspondence. The subjects in one group have nothing to do with the subjects in the other, and the groups may have different sizes. Any observation in the first group could be compared with any in the second equally well. A trial that randomizes patients to one drug or the other produces independent samples (each patient's outcome under the other drug is never observed, the starting point of Potential Outcomes and the Average Treatment Effect), and so does a survey comparing men with women.
Which kind of data a study has is settled by how the data were collected, not by looking at the numbers. Two columns of equal length are not paired unless the rows mean something.
Example (shuffling one column). If the drug 1 values of the sleep trial were shuffled among the ten patients, leaving the drug 2 values in place, the mean of the ten differences would still be 1.58 hours, but the pairing would be gone. The mean of the differences equals the difference of the two column means, since $\frac{1}{n}\sum (x_{i2} - x_{i1}) = \bar{x}_2 - \bar{x}_1$, and shuffling a column does not change its mean. The gain from pairing would be lost, because each drug 1 value would now sit next to a stranger's drug 2 value. The next section shows that the gain lives entirely in the correlation between a patient's two values, and a shuffle leaves only a chance correlation between the columns.
The reverse mistake is as real. A paired analysis of two independent groups that happen to have equal sizes pairs observations arbitrarily, and its result then depends on the arbitrary order.
Where the gain comes from
Here is the idea in one sentence. A difference between two measurements on the same subject cancels whatever that subject brings to both, so it varies less than a difference between two different subjects.
The formal version. Let $X_1$ and $X_2$ be the two measurements on a randomly chosen subject. They have means $\mu_1$ and $\mu_2$, standard deviations $\sigma_1$ and $\sigma_2$, and correlation $\rho$. The difference $D = X_1 - X_2$ has mean $\delta = \mu_1 - \mu_2$, the quantity of interest. Its variance follows by expanding the square of $D - \delta = (X_1 - \mu_1) - (X_2 - \mu_2)$ and taking expectations term by term:
$$\operatorname{Var}(D) = E\big[(X_1 - \mu_1)^2\big] + E\big[(X_2 - \mu_2)^2\big] - 2E\big[(X_1 - \mu_1)(X_2 - \mu_2)\big] = \operatorname{Var}(X_1) + \operatorname{Var}(X_2) - 2\operatorname{Cov}(X_1, X_2).$$
This is the rule for the variance of a sum, proved in Random Variables, Expectation and Variance, applied to $X_1 + (-X_2)$. (Expectation, Variance and Covariance is the general account of covariance and correlation, with the proof that a correlation lies between $-1$ and 1.) The correlation is defined as $\rho = \operatorname{Cov}(X_1, X_2)/(\sigma_1\sigma_2)$, so
$$\operatorname{Var}(D) = \sigma_1^2 + \sigma_2^2 - 2\rho\,\sigma_1\sigma_2.$$
Two subjects measured once each, one under each condition, give a difference whose variance is $\sigma_1^2 + \sigma_2^2$. Measurements on different subjects are independent, so the covariance term is zero. The same subject measured twice gives a difference whose variance is smaller by $2\rho\sigma_1\sigma_2$.
When subjects differ a great deal from one another, a subject who is high on one measurement tends to be high on the other. Then $\rho$ is large and positive, and most of the variance cancels. What cancels is exactly the variation between subjects: the patient who sleeps badly on both drugs, or the person whose blood pressure is high on every reading. The same identity, for yes-or-no outcomes, explains the gain in McNemar's test.
Example (a negative correlation). Pairing makes the variance of a difference larger than $\sigma_1^2 + \sigma_2^2$ exactly when $\rho$ is negative: then $-2\rho\sigma_1\sigma_2$ is positive and adds to the variance. That would happen if subjects who are high on one measurement tended to be low on the other. It is rare for two measurements of the same quantity on the same person, but the identity shows that pairing helps only through a positive correlation.
Checking the identity on Student's data
The identity holds for samples too, with $s_1$, $s_2$ and the sample correlation $r$ in place of the population values. The proof is the same expansion with sums in place of expectations. Each difference's deviation from the mean difference is $d_i - \bar{d} = (x_{i1} - \bar{x}_1) - (x_{i2} - \bar{x}_2)$. Squaring, summing over the $n$ pairs and dividing by $n - 1$ gives
$$s_d^2 = s_1^2 + s_2^2 - 2s_{12}, \qquad s_{12} = \frac{1}{n-1}\sum_{i=1}^{n}(x_{i1} - \bar{x}_1)(x_{i2} - \bar{x}_2),$$
and the sample correlation is defined as $r = s_{12}/(s_1 s_2)$, so $s_d^2 = s_1^2 + s_2^2 - 2rs_1s_2$ exactly. This $r$ is Pearson's coefficient, whose bounds and tests are proved in Correlation: Pearson, Spearman and Kendall. For Student's data, with $d_i$ the drug 2 value minus the drug 1 value:
| Drug 1 | Drug 2 | Difference $d_i$ | |
|---|---|---|---|
| Mean (hours) | 0.750 | 2.330 | 1.580 |
| Standard deviation (hours) | 1.7890 | 2.0022 | 1.2300 |
The correlation between the two drugs' values is $r = 0.7952$. Then
$$s_d^2 = s_1^2 + s_2^2 - 2 r s_1 s_2 = 3.2006 + 4.0090 - 2(0.7952)(1.7890)(2.0022) = 1.5129,$$
and $s_d = \sqrt{1.5129} = 1.2300$, the standard deviation of the ten differences computed directly. Without the covariance term the standard deviation would have been $\sqrt{3.2006 + 4.0090} = 2.6851$ hours, more than twice as large.
The patients differed far more from one another than the drugs did. The drug 1 values run from $-1.6$ to $3.7$ hours, while nine of the ten differences lie between 0.0 and 2.4.
The left panel is what a paired test sees, and the right panel is what an unpaired test sees. The next section turns the left panel into a test.
The paired t-test
Since $D$ is a single random variable, a paired comparison is a one-sample problem. The $n$ differences $d_1, \dots, d_n$ are a sample from the population of differences. The question about two means becomes a question about one, $\delta = \mu_1 - \mu_2$. Everything in Confidence Intervals for a Mean and Hypothesis Tests for a Mean applies to the differences unchanged, because those articles assume only a random sample from one population, and the differences are one. In the course text's notation:
- the differences are $d_i = x_{i1} - x_{i2}$, with mean $\bar{d} = \frac{1}{n}\sum d_i$ and standard deviation $s_d = \sqrt{\sum (d_i - \bar{d})^2/(n-1)}$, where $n$ is the number of pairs, not the number of measurements;
- the hypotheses are $H_0: \delta = \mu_1 - \mu_2 = 0$ (equivalently $\mu_1 = \mu_2$) against $H_A: \delta \ne 0$, or a one-sided alternative;
- the test statistic is
$$t = \frac{\bar{d} - \delta}{s_d/\sqrt{n}},$$
evaluated at the null value of $\delta$. It follows a $t$ distribution with $n - 1$ degrees of freedom when $H_0$ is true and the differences come from a normal population. That is the one-sample result proved in The Chi-Squared and t Distributions, applied to the sample $d_1, \dots, d_n$;
- the $100(1-\alpha)\%$ confidence interval for $\delta$ is
$$\bar{d} \pm t_{n-1,\,1-\alpha/2}\,\frac{s_d}{\sqrt{n}},$$
and the one-sided lower bound is $\bar{d} - t_{n-1,\,1-\alpha}\,s_d/\sqrt{n}$ when only an increase is of interest.
The null value need not be zero. The NIST handbook (§1.3.5.3) notes that a new treatment may be worth adopting only if it beats the current one by some threshold. The null hypothesis then states that the difference equals that threshold, and $\delta$ in the numerator is the threshold.
Student's sleep data
Confidence Intervals for a Mean worked the calculation step by step, so only the results are collected here. With $n = 10$ pairs, $\bar{d} = 1.580$ and $s_d = 1.2300$, the standard error is $1.2300/\sqrt{10} = 0.3890$ hours and
$$t = \frac{1.580 - 0}{0.3890} = 4.062, \qquad p = 2\,P(T_9 \ge 4.062) = 0.0028.$$
The 95% interval is $1.580 \pm 2.2622 \times 0.3890 = [0.700, 2.460]$ hours. Suppose instead the trial had been designed to ask only whether drug 2 adds sleep. Then the one-sided 95% lower bound is
$$1.580 - t_{9,\,0.95} \times 0.3890 = 1.580 - 1.8331 \times 0.3890 = 0.867 \text{ hours},$$
and the one-sided $p$-value is 0.0014. The data are consistent with drug 2 adding at least about 0.87 hours. The side of the bound has to come from the protocol, not from the data, as One-Sided Confidence Bounds and Sample Size explains.
That is the analysis as designed. The next section runs the analysis that ignores the design on the same twenty numbers.
Ignoring the pairing
Suppose the twenty numbers had been analyzed as two independent groups of ten, as if twenty different patients had taken part. The two-sample $t$-test of the next article compares the difference in means, which is still 1.580 hours, with a standard error built from the spread within each group:
$$s_p^2 = \frac{9(1.7890)^2 + 9(2.0022)^2}{18} = 3.6048, \qquad SE = s_p\sqrt{\frac{1}{10} + \frac{1}{10}} = 1.8986 \times 0.4472 = 0.8491.$$
Then $t = 1.580/0.8491 = 1.861$ on 18 degrees of freedom, and $p = 0.079$. The 95% interval for the difference is $[-0.204, 3.364]$ hours. Welch's version of the test does not assume equal variances. It gives the same $t$ (the groups have equal sizes) on 17.78 degrees of freedom, and $p = 0.079$.
| Analysis | Standard error (hours) | $t$ | df | $p$ | 95% interval (hours) |
|---|---|---|---|---|---|
| Paired $t$ (as designed) | 0.3890 | 4.062 | 9 | 0.0028 | $[0.700, 2.460]$ |
| Two-sample $t$ (pairing ignored) | 0.8491 | 1.861 | 18 | 0.079 | $[-0.204, 3.364]$ |
The estimate is identical, and only its standard error differs, by a factor of $0.8491/0.3890 = 2.18$. The unpaired analysis is not significant at 0.05.
The unpaired standard error is not wrong for an experiment with twenty different patients. It is wrong for this one, because it charges the comparison with the variation between patients. Every patient here took both drugs, so that variation never entered the comparison. The unpaired analysis also gets the degrees of freedom wrong in the opposite direction: 18 instead of 9, as if there were twenty independent pieces of information about the drugs rather than ten.
Errors of this kind are easy to make with software, because the paired and unpaired tests take the same two columns of numbers. The information retrieval wiki's Significance Testing shows the same mistake on a comparison of two search engines over the same queries. There, ignoring the pairing turns $p = 0.001$ into $p = 0.27$. Paired Comparisons of Models applies the same variance identity to two language models scored on the same questions: on HELM's 14,042 MMLU questions, pairing cuts the standard error of the difference from 0.49 to 0.34 percentage points.
Ten patients are one sample. To see what ignoring the pairing does in general, we need a population of pairs whose truth we know.
A large-scale check: repeated blood pressure readings
The NHANES examination of 2017 to 2018 is the source of the blood pressure population used throughout this course. It recorded several systolic readings for each participant in succession at the same examination. The 4,782 adults who have both a first and a third reading form a population of pairs: a self-paired design with a known truth.
| Reading 1 | Reading 3 | Difference (1 minus 3) | |
|---|---|---|---|
| Mean (mm Hg) | 125.79 | 125.00 | 0.786 |
| Standard deviation (mm Hg) | 19.65 | 19.35 | 5.629 |
The correlation between the two readings is 0.9584. In this population the first reading is higher than the third by 0.79 mm Hg on average, and the population splits three ways:
- 46.7% of adults have a higher first reading;
- 15.8% have identical readings (the readings are recorded in steps of 2 mm Hg);
- 37.5% have a lower first reading.
The difference is small next to the variation between people, a standard deviation of about 19.5 mm Hg for a single reading. But the two readings of one person agree closely, and the variance identity shows how much that matters. Without pairing, the standard deviation of a difference would be $\sqrt{19.65^2 + 19.35^2} = 27.58$ mm Hg. With it, the standard deviation is 5.63 mm Hg, about one fifth. Effect Sizes and Standardized Differences (Problem 2) measures the same first-minus-third difference on two standardized scales: about a seventh of a standard deviation of the differences, but only a twenty-fifth of one between people.
One study of 40 adults
A random sample of 40 of these adults (the script's seed 1) shows the effect on a single study.
- Paired analysis: $\bar{d} = 0.900$, $s_d = 7.203$, standard error $1.139$, $t = 0.790$ on 39 degrees of freedom, $p = 0.43$, and a 95% interval of $[-1.40, 3.20]$ mm Hg.
- Unpaired analysis of the same 80 readings: standard error $3.596$, $t = 0.250$, $p = 0.80$, and an interval of $[-6.26, 8.06]$ mm Hg, more than three times as wide.
Neither rejects, because the true difference is too small for 40 people to detect. But the paired interval already rules out a difference larger than about 3 mm Hg in either direction. The unpaired one rules out almost nothing of practical interest.
Many studies
Example (the unpaired test's error rate). The unpaired test uses the wrong standard error, and when there is no true difference it rejects too rarely, by a wide margin. The script drew 10,000 samples of each size from the population of pairs, for each of 30 seeds, and applied both tests at $\alpha = 0.05$ (medians over the seeds). With the population shifted so that the mean difference was exactly zero, the paired test rejected in 4.95% of samples of 25 and 5.01% of samples of 100, as a test at $\alpha = 0.05$ should. The unpaired test never rejected at all.
The same simulation, on the unshifted population, measures the gap in power:
| Adults in the sample | Power, paired $t$ | Power, two-sample $t$ (pairing ignored) |
|---|---|---|
| 25 | 0.098 | 0.000 |
| 50 | 0.160 | 0.000 |
| 100 | 0.281 | 0.000 |
| 200 | 0.503 | 0.000 |
| 400 | 0.797 | 0.000 |
With 400 adults the paired test detects the 0.79 mm Hg difference four times in five. The unpaired test, at these sizes, never does.
The variance identity explains why. The unpaired standard error is built as if the spread of a difference were 27.58 mm Hg. The actual spread of the difference in means comes from the paired differences, 5.63 mm Hg, about a fifth as much. So the unpaired $t$ statistic varies from sample to sample with a standard deviation of about $5.63/27.58 = 0.20$ instead of 1. With no true difference, it would have to land about ten of its own standard deviations from zero to pass 1.96. Even with 400 adults, where the true difference puts its center near 0.57, it would need about seven. Neither happened in any sample.
The direction of the error is general, and its size depends on the correlation. With $n$ pairs, the difference in means has variance $(\sigma_1^2 + \sigma_2^2 - 2\rho\sigma_1\sigma_2)/n$, while the square of the unpaired standard error, $s_p^2(2/n) = (s_1^2 + s_2^2)/n$, has expectation $(\sigma_1^2 + \sigma_2^2)/n$ whatever the correlation. The ratio of the true standard error to the assumed one is
$$\sqrt{1 - \frac{2\rho\,\sigma_1\sigma_2}{\sigma_1^2 + \sigma_2^2}},$$
which is below 1 exactly when $\rho$ is positive. For the blood pressure readings it is 0.204, and for Student's data, with the sample values, $0.3890/0.8491 = 0.458$. So ignoring a positive correlation does not make a test reject too often. It makes the test too cautious, and at a correlation of 0.96 so cautious that it rejected nothing in these simulations.
When pairing costs more than it gains
So far pairing has only helped. Is there a design in which it hurts? Yes: one in which the two measurements of a pair are nearly uncorrelated.
Pairing has a price, paid in degrees of freedom. With $n$ pairs the paired test has $n - 1$ degrees of freedom, while two independent groups of $n$ subjects give a two-sample test with $2n - 2$. When $\rho$ is close to zero, the paired design gains nothing in variance and loses half its degrees of freedom. It is then slightly less powerful than an independent-groups design with the same number of measurements.
The size of the effect can be computed exactly. For a paired design with $n$ pairs and equal standard deviations $\sigma$, the variance identity gives the differences the variance $\sigma^2 + \sigma^2 - 2\rho\sigma^2 = 2\sigma^2(1 - \rho)$, a standard deviation of $\sigma\sqrt{2(1 - \rho)}$. The power of the paired test follows from the noncentral $t$ distribution with $n - 1$ degrees of freedom and noncentrality $\delta\sqrt{n}/(\sigma\sqrt{2(1 - \rho)})$, as derived in Power and Sample Size for a Test of a Mean for any one-sample $t$-test. For two independent groups of $n$, the power of the two-sample test comes from the noncentral $t$ with $2n - 2$ degrees of freedom and noncentrality $\delta\sqrt{n}/(\sigma\sqrt{2})$, as derived in Sample Size for Comparing Two Means. At $\rho = 0$ the two noncentralities are equal, and the designs differ only in their degrees of freedom.
Example (ten pairs against two groups of ten). With a true difference of one standard deviation and $\rho = 0$, two independent groups of 10 have more power than 10 pairs: 0.562 against 0.514. With no correlation the variances match, and the extra degrees of freedom decide it. The table shows how quickly a correlation reverses the order:
| Correlation $\rho$ | 0 | 0.05 | 0.10 | 0.20 | 0.50 | 0.80 |
|---|---|---|---|---|---|---|
| Power, 10 pairs | 0.514 | 0.535 | 0.557 | 0.606 | 0.803 | 0.993 |
| Power, two groups of 10 | 0.562 | 0.562 | 0.562 | 0.562 | 0.562 | 0.562 |
The break-even correlation is 0.11 for this design and 0.03 for a larger one (30 pairs, a difference of half a standard deviation), because the loss of degrees of freedom matters less as $n$ grows. Measurements on the same person are usually correlated far more strongly than that: 0.80 for the sleep data and 0.96 for repeated blood pressure readings.
The practical lesson is that self-pairing almost always pays, while matching pays only when the matching variables are related to the outcome. Matching on characteristics that do not predict the outcome produces pairs with $\rho$ near zero. The analysis then pays the price in degrees of freedom for nothing. Blocking and Factorial Designs reaches the same lesson for randomized experiments without a normal model: pairs formed on an irrelevant variable gain nothing on average.
A paired design can also be less convenient in ways that have nothing to do with variance.
- A crossover trial assumes that the first treatment's effect is gone before the second begins, and that the order of treatment does not matter. A drug with lasting effects, or a disease that changes over the course of the trial, breaks the comparison.
- A before-and-after study without a control group measures change, not its cause. Anything else that happened between the two measurements is mixed into the mean difference. So is any tendency of unusually high first measurements to be followed by more ordinary ones.
- A pair with one measurement missing contributes nothing to a paired analysis.
Assumptions
The paired $t$-test assumes that the pairs are independent of one another. For exact error rates in small samples, it also assumes that the differences come from a normal population.
The normality assumption is about the differences, not about the original measurements. The sleep values for each drug are spread over several hours, but the test only needs the ten differences to look like a sample from a normal distribution. Differences between two similar measurements are often more symmetric than the measurements themselves. One case is exact: if exchanging a pair's two measurements does not change their joint distribution, as under a null hypothesis of no difference of any kind between the two conditions, then $D = X_1 - X_2$ and $-D = X_2 - X_1$ have the same distribution. The differences are then symmetric about zero, however skewed each measurement is. For strongly skewed differences or outliers, the sign test and the Wilcoxon signed-rank test apply to the same differences with weaker assumptions. Fisher's check of the sleep data by the signs of the differences is described in Hypothesis Tests for a Mean.
Worked problems
The first problem is an exercise in the course text's chapter on the comparison of two means (Pagano, Gauvreau and Mattie, 2022), restated here with its data and solved in full. The second and third are posed here, on the same data and on Student's sleep data. The script recomputes every number.
Problem 1 (saliva cotinine after one cigarette). Cotinine in saliva is a marker of exposure to tobacco smoke. Seven subjects, none of them heavy smokers and all abstinent for at least a week, each smoked one cigarette. Their saliva cotinine levels were measured 12 and 24 hours afterwards:
| Subject | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| After 12 hours | 73 | 58 | 67 | 93 | 33 | 18 | 147 |
| After 24 hours | 24 | 27 | 49 | 59 | 0 | 11 | 43 |
Let $\mu_{12}$ and $\mu_{24}$ be the population mean levels at the two times, and $\delta = \mu_{12} - \mu_{24}$. If the means differ, the later one is believed to be the lower. Cotinine levels are assumed to be approximately normal. (a) Construct a one-sided 95% confidence interval for $\delta$. (b) Test the null hypothesis that the two means are equal, with a one-sided test at $\alpha = 0.05$.
Solution. The answers are: (a) $\delta \ge 16.37$ with 95% confidence; (b) $t = 3.323$ on 6 degrees of freedom, one-sided $p = 0.0080$, so the null hypothesis is rejected.
The design is paired, since each subject supplies both measurements, so the analysis is a one-sample analysis of the seven differences $d_i$ (12 hours minus 24 hours):
$$49, \quad 31, \quad 18, \quad 34, \quad 33, \quad 7, \quad 104.$$
Their sum is 276, so $\bar{d} = 276/7 = 39.43$. The squared deviations from $\bar{d}$ are 91.61, 71.04, 459.18, 29.47, 41.33, 1051.61 and 4169.47, with sum 5913.71. So
$$s_d^2 = \frac{5913.71}{6} = 985.62, \qquad s_d = 31.39, \qquad \frac{s_d}{\sqrt{7}} = \frac{31.39}{2.6458} = 11.866.$$
(a) The belief that the later mean can only be lower makes an increase the only alternative of interest, so the interval is a lower bound for $\delta$. With $t_{6,\,0.95} = 1.9432$,
$$\bar{d} - t_{6,\,0.95}\,\frac{s_d}{\sqrt{n}} = 39.43 - 1.9432 \times 11.866 = 39.43 - 23.06 = 16.37.$$
With 95% confidence, the mean cotinine level falls by at least 16.37 units between 12 and 24 hours. The whole interval $[16.37, \infty)$ lies above zero.
(b) The hypotheses are $H_0: \delta = 0$ against $H_A: \delta > 0$. The statistic is
$$t = \frac{39.43 - 0}{11.866} = 3.323$$
on $7 - 1 = 6$ degrees of freedom. It exceeds the critical value 1.9432, and $p = P(T_6 \ge 3.323) = 0.0080$. The null hypothesis is rejected at the 0.05 level: mean saliva cotinine is lower at 24 hours than at 12. The test and the bound agree, as they must. The one-sided test rejects exactly when $\bar{d}/(s_d/\sqrt{n}) > t_{6,\,0.95}$, which rearranges to $\bar{d} - t_{6,\,0.95}\,s_d/\sqrt{n} > 0$: the lower bound is above zero.
The result leans on the assumption of normal differences, which seven values cannot check, and subject 7's difference of 104 is far from the rest. A check that does not use the sizes of the differences points the same way. All seven differences are positive. If positive and negative differences were equally likely, that would happen with probability $(1/2)^7 = 0.0078$.
Problem 2 (the same data with the pairing ignored). For the cotinine data of Problem 1, verify the variance identity $s_d^2 = s_1^2 + s_2^2 - 2rs_1s_2$, and find what the one-sided analysis would have reported if the two columns had been treated as independent groups of seven.
Solution. The identity holds, with $r = 0.6969$; the unpaired analysis gives $t = 2.210$ on 12 degrees of freedom, one-sided $p = 0.0236$ and a lower bound of 7.63, against 16.37 for the paired analysis.
The two columns have means 69.857 and 30.429, variances $s_1^2 = 1782.14$ and $s_2^2 = 445.95$, and covariance $s_{12} = 621.24$. So $r = 621.24/\sqrt{1782.14 \times 445.95} = 621.24/891.49 = 0.6969$, and
$$s_1^2 + s_2^2 - 2s_{12} = 1782.14 + 445.95 - 1242.48 = 985.61,$$
which is $s_d^2 = 985.62$ up to the rounding of the three terms.
Treated as independent groups of equal size, the two samples have pooled variance $s_p^2 = (1782.14 + 445.95)/2 = 1114.05$ (The Two-Sample t-Test defines it). The standard error of the difference in means is
$$\sqrt{1114.05\left(\frac{1}{7} + \frac{1}{7}\right)} = \sqrt{318.30} = 17.841,$$
which is 1.504 times the paired standard error of 11.866. The difference in means is still $69.857 - 30.429 = 39.43$, so $t = 39.43/17.841 = 2.210$ on $7 + 7 - 2 = 12$ degrees of freedom, with one-sided $p = 0.0236$. With $t_{12,\,0.95} = 1.7823$, the lower bound is $39.43 - 1.7823 \times 17.841 = 7.63$.
Both analyses reject at 0.05 here, because the effect is large. The unpaired one understates what the data show: its bound is less than half the paired bound. The ratio of the two standard errors is the one the variance identity predicts, $\sqrt{1 - 2s_{12}/(s_1^2 + s_2^2)} = \sqrt{1 - 1242.48/2228.09} = 0.665 = 1/1.504$.
Problem 3 (a null value that is not zero). Suppose drug 2 of the sleep trial is worth adopting only if it adds more than half an hour of sleep over drug 1. Test $H_0: \delta = 0.5$ against $H_A: \delta > 0.5$ at $\alpha = 0.05$ on Student's ten differences, and find the largest threshold that the data would still reject.
Solution. The test rejects, with $t = 2.777$ and $p = 0.0108$; the largest threshold rejected at the 0.05 level is 0.867 hours.
With $\bar{d} = 1.580$ and standard error $1.2300/\sqrt{10} = 0.3890$, the statistic evaluated at the null value is
$$t = \frac{1.580 - 0.5}{0.3890} = 2.777$$
on 9 degrees of freedom (computed with the unrounded standard error, 0.38896). It exceeds $t_{9,\,0.95} = 1.8331$, and $p = P(T_9 \ge 2.777) = 0.0108$. So the data support an improvement of more than half an hour.
For a general threshold $\delta_0$, the test rejects when $(1.580 - \delta_0)/0.3890 > 1.8331$, that is, when $\delta_0 < 1.580 - 1.8331 \times 0.3890 = 0.867$. The thresholds the one-sided test rejects are exactly those below the one-sided 95% lower bound found above. A requirement of a full hour's improvement, for example, is not established by these ten patients: $t = (1.580 - 1)/0.3890 = 1.491$, which is below 1.8331.
What we have learned
A paired design turns a comparison of two means into a one-sample problem on the differences. The variance of a difference, $\sigma_1^2 + \sigma_2^2 - 2\rho\sigma_1\sigma_2$, shows that the gain comes entirely from the correlation within pairs. On Student's data that correlation, 0.80, cut the standard error by a factor of 2.18 and turned $p = 0.079$ into $p = 0.0028$. On repeated blood pressure readings, ignoring the pairing left a test that almost never rejected. Pairing loses only when the correlation is near zero, below about 0.11 for ten pairs. The number of pairs a paired study needs, and how much smaller it is than a parallel-group study, is worked out in Sample Size for Comparing Two Means.
Many comparisons cannot be paired at all: men and women, or patients randomized to one drug or the other. Without a correlation to remove, the variation in both groups enters the standard error. The Two-Sample t-Test builds the test for that case, and Welch's t-Test and Unequal Variances gives Welch's version for groups that vary by different amounts.
In Python
import numpy as np
from scipy import stats
drug1 = np.array([0.7, -1.6, -0.2, -1.2, -0.1, 3.4, 3.7, 0.8, 0.0, 2.0])
drug2 = np.array([1.9, 0.8, 1.1, 0.1, -0.1, 4.4, 5.5, 1.6, 4.6, 3.4])
res = stats.ttest_rel(drug2, drug1) # paired: same as ttest_1samp(drug2 - drug1, 0)
print(res.statistic, res.pvalue) # 4.062, 0.00283
print(res.confidence_interval(0.95)) # about (0.700, 2.460)
print(stats.ttest_rel(drug2, drug1, alternative='greater').confidence_interval(0.95)) # lower bound 0.867
wrong = stats.ttest_ind(drug2, drug1) # pairing ignored
print(wrong.statistic, wrong.pvalue) # 1.861, 0.079
ttest_rel and ttest_ind accept the same two arrays, so the software cannot tell which design produced them; the analyst has to. Every number in this article is computed by tools/experiments/applied-statistics/paired-samples-t-test.py in the site's repository. The script implements the $t$ and noncentral $t$ distributions directly and was checked against scipy 1.17.1.
References
- Cushny, A. R., and Peebles, A. R. (1905). The action of optical isomers. II. Hyoscines. The Journal of Physiology, 32(5–6), 501–510. record · 3 pages
- National Center for Health Statistics (2020). National Health and Nutrition Examination Survey 2017–2018: Demographic Variables and Sample Weights (DEMO_J) and Blood Pressure (BPX_J) data files. Centers for Disease Control and Prevention. https://wwwn.cdc.gov/nchs/nhanes/continuousnhanes/default.aspx?BeginYear=2017 record · 109 pages
- NIST/SEMATECH. e-Handbook of Statistical Methods, §1.3.5.3 (Two-sample t-test for equal means). National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/ record · 37 pages
- Pagano, M., Gauvreau, K., and Mattie, H. (2022). Principles of Biostatistics (3rd ed.). CRC Press. The course text. record · 48 pages
- Senn, S., and Richardson, W. (1994). The first t-test. Statistics in Medicine, 13(8), 785–803. record · 2 pages
- Student (1908). The probable error of a mean. Biometrika, 6(1), 1–25. record · 17 pages
Reviewed: verified, 16 Nov 2026 · checked against sources, 23 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 23 Nov 2026 · 10 revisions