Confidence intervals

Confidence interval for paired means

Estimate the mean change between two related measurements, such as before/after or two methods applied to the same units.

Calculator

Enter the mean and standard deviation of the individual differences, along with the number of pairs.

Result pending…

Explanation

Paired means arise when each data point in one group is related to a specific data point in the other: before/after measurements on the same person, two instruments applied to the same sample, or matched twins/pairs. The unit of analysis is not two separate groups, but pairs of observations.

Paired samples are used when there is a natural unit-to-unit correspondence and that correspondence carries information: the same patient before and after a treatment, the same batch measured by two methods, or subjects matched by age, sex, or another characteristic. By contrast, the CI for the difference of independent means is used when the groups are distinct and there is no observation-to-observation pairing.

The key is not to treat the groups as independent. First, an individual difference is computed for each pair, for example \(d_i = \text{after}_i - \text{before}_i\). Then a t interval is built for the population mean of those differences, \(\mu_d\). This takes advantage of the correlation within each pair and removes part of the between-individual variability.

Formula

Let \(C\) denote the confidence level and \(\alpha=1-C\) the total area outside the interval. For 95% confidence, \(C=0.95\), \(\alpha=0.05\) and \(\alpha/2=0.025\) in each tail.

\( \bar{d} \pm t_{\alpha/2,\, n-1}\cdot \dfrac{s_d}{\sqrt{n}} \)

  • \(\bar{d}\): sample mean of the individual differences.
  • \(s_d\): sample standard deviation of the differences.
  • \(n\): number of pairs observed.
  • \(t_{\alpha/2,\,n-1}\): critical value of Student's t with \(n-1\) degrees of freedom.

The margin of error is \(E=t_{\alpha/2,\,n-1}s_d/\sqrt{n}\), and the interval is \([\bar{d}-E,\;\bar{d}+E]\).

Worked example

In 18 patients a variable is measured before and after an intervention, defining \(d=\text{after}-\text{before}\). The mean of the differences is \(\bar{d}=4.2\) and its standard deviation is \(s_d=6.1\). It's important that \(s_d\) be the standard deviation of the individual differences, not the standard deviation of the before measurements or the after measurements separately.

For 95% confidence we take \(C=0.95\), so \(\alpha=1-C=0.05\) and \(\alpha/2=0.025\). With \(n=18\), the degrees of freedom are \(df=n-1=17\), and the two-sided critical value is approximately \(t_{0.025,17}=2.110\).

The standard error of the mean of the differences is:

\( SE=\dfrac{s_d}{\sqrt{n}}=\dfrac{6.1}{\sqrt{18}}\approx1.438 \)

The margin of error is:

\( E=t\cdot SE=2.110\cdot1.438\approx3.03 \)

Therefore, the confidence interval is:

\( 4.2 \pm 3.03 \approx [1.17,\;7.23] \)

Since the interval does not include 0, the mean change is positive at 95% confidence under the definition \(d=\text{after}-\text{before}\). Had \(d=\text{before}-\text{after}\) been used instead, the same data would produce the interval with the opposite sign.

Assumptions for paired means

  • The pairs are independent of one another.
  • The distribution of the differences is approximately normal, especially important with few pairs.
  • 0 is the null value: if the CI includes 0, the data are compatible with no mean change.
  • The sign depends on how you define the difference. If you switch from \(\text{after}-\text{before}\) to \(\text{before}-\text{after}\), the interval changes sign.

How does it differ from the CI for the difference of independent means?

With independent samples, two distinct groups are compared and the variability depends on \(s_1\), \(s_2\), \(n_1\) and \(n_2\). With paired means, each pair is summarized into a single difference \(d_i\), and the relevant variability is \(s_d\).

Situation Data needed Estimated parameter When to use it
Paired means Differences \(d_i\), or \(\bar d\), \(s_d\) and \(n\). Mean change: \(\mu_d\). Before/after, methods measured on the same units, matched pairs.
Independent means \(\bar x_1\), \(\bar x_2\), \(s_1\), \(s_2\), \(n_1\), \(n_2\). Difference of means: \(\mu_1-\mu_2\). Two groups with no unit-to-unit correspondence.

Ignoring the pairing usually loses information: if the measurements within each pair are correlated, analyzing the differences can substantially reduce the standard error.

How to interpret the result

The interval \([L, U]\) is the plausible range for the population mean of the individual differences \(\mu_d\) at the chosen confidence level. Remember that \(\mu_d\) is not the difference of two independent means, but the mean change within each pair: the same parameter that would be measured, on average, over all possible individual changes in the population. If the experiment were repeated many times with \(n\) pairs, a proportion \(C\) of the CIs built with the same method would contain the true value of \(\mu_d\).

The reference value for this type of interval is 0, which represents no mean change. If \(0 \in [L, U]\), the data are compatible with there being no systematic change at the chosen confidence level; equivalently, the two-sided test \(H_0\!: \mu_d = 0\) would not be rejected at level \(\alpha = 1 - C\). If \(L > 0\), the mean change is positive under the chosen difference definition; if \(U < 0\), the mean change is negative. The direction of the interval depends directly on how \(d_i\) is defined: switching from "after − before" to "before − after" flips the signs of all the bounds.

  • Advantage of pairing: by working with individual differences \(d_i\), the between-individual variability that is not relevant to estimating the change is removed. The standard error \(s_d/\sqrt{n}\) is usually smaller than what would be obtained by treating the groups as independent, so the paired CI is typically narrower and more precise.
  • Width and uncertainty: the width of the interval depends on \(s_d\) (the variability of the change between individuals), \(n\) (the number of pairs), and the confidence level. Increasing \(n\) or reducing \(s_d\) (for example, by improving the homogeneity of the pairing) reduces the margin of error.
  • Reading the chart: the green region under the t curve is the confidence zone and the red tails (area \(\alpha/2\) each) delimit the critical values \(\pm t_{\alpha/2,\,n-1}\). The interval on the original scale \([\bar{d} - E, \bar{d} + E]\) corresponds to the values of \(\mu_d\) whose t statistic would fall inside the green region.

Frequently asked questions

  • Can I use the two means separately? That's not recommended. For paired data you need the individual differences or, at least, \(\bar d\), \(s_d\) and \(n\).
  • What happens if the CI includes 0? There is not enough evidence of mean change at the chosen confidence level.
  • What sign will the interval have? It depends on the definition of \(d\). The calculator shows the selected definition to avoid confusion.

References used

  • Student (1908). The probable error of a mean, Biometrika, 6, 1–25.
  • Altman, D. G. (1991). Practical Statistics for Medical Research. Chapman & Hall.
  • Agresti, A. and Franklin, C. (2018). Statistics: The Art and Science of Learning from Data. Pearson.