## Paired $t$-test (Dependent Sample)

Let $X_1, X_2, \cdots, X_n$ and $Y_1, Y_2, \cdots, Y_n$ be two dependent samples each of size $n$ with respective means $\mu_1$ and $\mu_2$.

Define $d_i = X_i - Y_i$, $i=1,2,\cdots, n$. Then $\mu_d= \mu_1 - \mu_2$.

Let $\overline{d}=\frac{1}{n} \sum d_i$ be the mean of the difference and $s_d=\sqrt{\frac{1}{n-1}\sum (d_i - \overline{d})^2}$ be the sample standard deviation of the difference.

The hypothesis testing problem can be set up as:

Situation Hypothesis Testing Problem
Situation A $H_0: \mu_d=0$ against $H_a : \mu_d < 0$ (Left-tailed)
Situation B $H_0: \mu_d=0$ against $H_a : \mu_d > 0$ (Right-tailed)
Situation C $H_0: \mu_d=0$ against $H_a : \mu_d \neq 0$ (Two-tailed)

## Formula

The test statistic for testing above hypothesis is

### $t=\frac{\overline{d}-\mu_d}{SE(\overline{d})}=\frac{\overline{d}-\mu_d}{s_d/\sqrt{n}}$

where

• $\overline{d} =\frac{1}{n}\sum d_i$ is sample mean of the difference,
• $s_d=\sqrt{\frac{\sum (d_i -\overline{d})^2}{n-1}}$ is sample standard deviation of the difference.
• $SE(\overline{d}) = \frac{s_d}{\sqrt{n}}$ is the standard error of $\overline{d}$.

The test statistic defined above follows Students $t$ distribution with $n-1$ degrees of freedom.