Paired Samples (Dependent $t$-test) Simulation

Demonstrating the sampling distribution of mean differences ($\bar{d}$). We simulate 1000 individuals, each with a Pre-test and Post-test score. The population of difference scores ($D = X_{post} - X_{pre}$) has a true mean $\mu_D = 5$ and standard deviation $\sigma_D = 10$. We repeatedly draw 10 pairs to find the sample mean difference.

Population ($N=1000$)

💡 Linked Subject Concept: Each participant ($P$) is measured twice. Hover over any dot in either box to highlight that exact same participant's twin score!
Pre-test Scores $\mu_{pre} = 50$
Post-test Scores $\mu_{post} = 55$
Distribution of Differences ($D = Post - Pre$) $\mu_D = 5, \sigma_D = 10$

Current Sample ($n=10$ pairs)

Participant ID Pre $\rightarrow$ Post Diff ($D$)
Waiting to sample pairs...
Mean ($\bar{d}$)
--
SD ($s_D$)
--
Est. SE
--

Sampling Distribution

0 / 100 Exp.
Mean of Means ($\mu_{\bar{d}}$)
--
Empirical SE
--
Avg. Estimated SE (using $s_D$)
--
Theoretical ($\sigma_D/\sqrt{n}$): ~3.16

Connecting to the Paired $t$-test

In a paired (dependent) $t$-test, each subject is measured twice (Pre and Post). Notice how a single sample draws a linked pair from both populations simultaneously. The test evaluates the difference scores ($D$) within each pair.

Why is a Paired t-test identical to a One-Sample t-test?

A paired-samples $t$-test is mathematically identical to performing a one-sample $t$-test on the column of difference scores. Here is why:

  • Null Hypothesis Transformation: The paired $t$-test tests whether the mean of Pre-test scores equals the mean of Post-test scores ($H_0: \mu_{pre} = \mu_{post}$). By subtracting them ($D = Post - Pre$), this is exactly equivalent to testing if the mean of the differences is zero ($H_0: \mu_D = 0$).
  • Removing Between-Subject Variance: Since we are testing the same individual twice, their baseline performance is "subtracted out". We no longer care about the variance in the Pre-test box or the Post-test box individually; we only care about the variance of the difference scores ($s_D$).
  • The Formula: The test statistic is calculated as $t = \frac{\bar{d} - \mu_0}{s_D / \sqrt{n}}$. If our null hypothesis is no change, then $\mu_0 = 0$, simplifying the numerator to just $\bar{d}$. This is the exact formula for a one-sample $t$-test against 0.

As you draw samples, the Estimated Standard Error ($s_D / \sqrt{n}$) varies from sample to sample because it relies on the sample's standard deviation ($s_D$). However, across 100 simulations, the average of these estimated standard errors closely approximates the true standard error (the empirical standard deviation of the sampling distribution on the right).