Two sample t test for means with unknown and unequal variances
In this tutorial we will discuss two sample t test for testing difference between two population means when the population variances are unknown and unequal.
Two sample t test for means with unknown and unequal 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 and unequal.
Assumptions
Assumptions for two sample $t$-test are as follows:
a. The population from which, the two samples drawn are Normal distributions.
b. The two population variances are unknown and unequal.
Step by Step Procedure
We wish to test the hypothesis $H_0 : \mu_1 = \mu_2$.
The standard error of difference between means is
$$ \begin{eqnarray*} SE(\overline{x}_1 - \overline{x}_2) &=& \sqrt{ \frac{s_1^2}{n_1}+ \frac{s_2^2}{n_2}}. \end{eqnarray*} $$
The step by step hypothesis testing procedure is as follows:
Step 1 State the hypothesis testing problem
The hypothesis testing problem can be structured in any one of the three situations as follows:
| 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) |
Step 2 Define the test statistic
The test statistic for testing above hypothesis is
$$ \begin{eqnarray*} 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)}{\sqrt{\frac{s^2_1}{n_1}+\frac{s^2_2}{n_2}}} \end{eqnarray*} $$
The test statistic $t$ follows Students’ $t$ distribution with $\nu$ degrees of freedom, where
$$ \begin{eqnarray*} \nu & =& \frac{\bigg(\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}\bigg)^2}{\frac{s_1^4}{n_1^2(n_1-1)}+\frac{s_2^4}{n_2^2(n_2-1)}} \end{eqnarray*} $$
The value of $\nu$ can be rounded to the nearest integer.
Step 3 Specify the level of significance $\alpha$
Step 4 Determine the critical values
For the specified value of $\alpha$ determine the critical region depending upon the alternative hypothesis.
- For left-tailed alternative hypothesis: Find the $t$-critical value using
$$ \begin{aligned} P(t<-t_\alpha) = \alpha. \end{aligned} $$ - For right-tailed alternative hypothesis: $t_\alpha$.
$$ \begin{aligned} P(t>t_\alpha) = \alpha. \end{aligned} $$ - For two-tailed alternative hypothesis: $t_{\alpha/2}$.
$$ P(t<- t_{\alpha/2} \text{ or } t > t_{\alpha/2}) = \alpha. $$
Step 5 Computation
Compute the test statistic under the null hypothesis $H_0$ using equation
$$ \begin{eqnarray*} t_{obs} &= & \frac{(\overline{x}_1-\overline{x}_2)-0}{\sqrt{\frac{s^2_1}{n_1}+\frac{s^2_2}{n_2}}} \end{eqnarray*} $$
Step 6 Decision (Traditional Approach)
It is based on the critical values.
- For left-tailed alternative hypothesis: Reject $H_0$ if
$t_{obs}\leq -t_\alpha$. - For right-tailed alternative hypothesis: Reject $H_0$ if
$t_{obs}\geq t_\alpha$. - For two-tailed alternative hypothesis: Reject $H_0$ if
$|t_{obs}|\geq t_{\alpha/2}$.
OR
Step 6 Decision ($p$-value Approach)
It is based on the $p$-value.
| Alternative Hypothesis | Type of Hypothesis | $p$-value |
|---|---|---|
| $H_a: \mu_1<\mu_2$ | Left-tailed | $p$-value $= P(t\leq t_{obs})$ |
| $H_a: \mu_1>\mu_2$ | Right-tailed | $p$-value $= P(t\geq t_{obs})$ |
| $H_a: \mu_1\neq \mu_2$ | Two-tailed | $p$-value $= 2P(t\geq abs(t_{obs}))$ |
If $p$-value is less than $\alpha$, then reject the null hypothesis $H_0$ at $\alpha$ level of significance, otherwise fail to reject $H_0$ at $\alpha$ level of significance.