## Two sample t test with unknown and equal variances

Let `$\overline{x}_1$`

be the sample mean and $s_1$ be the sample standard deviation of a random sample of size $n_1$ from a population with mean $\mu_1$ and variance `$\sigma^2_1$`

.

Let `$\overline{x}_2$`

be the sample mean and $s_2$ be the sample standard deviation of a random sample of size $n_2$ from a population with mean $\mu_2$ and variance `$\sigma^2_2$`

.

Suppose the variances $\sigma^2_1$ and $\sigma^2_2$ are unknown but equal.

The hypothesis testing problem can be set up as:

Situation | Hypothesis Testing Problem |
---|---|

Situation A : | $H_0: \mu_1=\mu_2$ against $H_a : \mu_1 < \mu_2$ (Left-tailed) |

Situation B : | $H_0: \mu_1=\mu_2$ against $H_a : \mu_1 > \mu_2$ (Right-tailed) |

Situation C : | $H_0: \mu_1=\mu_2$ against $H_a : \mu_1 \neq \mu_2$ (Two-tailed) |

## Formula

The test statistic for testing above hypothesis is

`$t=\frac{(\overline{x}_1-\overline{x}_2)-(\mu_1-\mu_2)}{SE(\overline{x}_1-\overline{x}_2)}= \frac{(\overline{x}_1-\overline{x}_2)-(\mu_1-\mu_2)}{s_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}$`

where

`$SE(\overline{x}_1-\overline{x}_2) = s_p\sqrt{\frac{1}{n_1}+ \frac{1}{n_2}}$`

is the standard error of difference between means,`$s_p=\sqrt{\frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}}$`

is the pooled standard deviation.

The test statistic $t$ follows Students’ $t$ distribution with $n_1+n_2-2$ degrees of freedom.