BioDeviceHub

Paired t-Test Calculator

Test the mean difference in paired measurements (before and after, or matched units) with the t statistic, p-value, a confidence interval, and the effect size dz.

Formula

di=xi,1−xi,2d_i = x_{i,1} - x_{i,2}
t=dˉsd/n,ν=n−1t = \dfrac{\bar{d}}{s_d/\sqrt{n}},\quad \nu = n - 1
dz=dˉsdd_z = \dfrac{\bar{d}}{s_d}
dd
the difference within each pair
nn
the number of pairs

How it works

When the same subjects or samples are measured twice, or units are matched, each pair contributes one difference, and the question is whether the mean difference is zero. A paired test is a one-sample t-test on the differences. Because it compares each unit with itself, it removes the variation between units, which makes it more sensitive than an unpaired test on the same data.

The pairing has to be real: measurements on the same unit, or units matched on a meaningful characteristic. A before-and-after design with no control group cannot separate the effect of a treatment from the effect of time or repeated measurement, whatever the p-value.

Worked example

Six samples measured before and after a treatment.

  1. The mean difference (before − after) is −0.583 with SD 0.264.
  2. t = −5.414 with 5 degrees of freedom; p = 0.0029.
  3. 95% CI for the mean difference: −0.860 to −0.306; dz = −2.21.

The second measurements are higher by 0.58 on average (95% CI 0.31 to 0.86); p = 0.0029 under the test's assumptions.

These are the values the calculator opens with, so you can check its output against this example.

Assumptions

  • Each pair is one unit measured twice, and pairs are independent of each other.
  • The differences (not the raw values) are roughly normally distributed.
  • The same measurement scale and conditions for both members of a pair.

Common mistakes

  • Pairing samples that are not really related, which wastes degrees of freedom.
  • Ignoring order effects, such as a learning or drift effect between the first and second measurement.
  • Using it for repeated measurements at more than two time points, which needs a different analysis.