# A quick question regarding hypothesis testing (decision variable)

This is what I have known:

If we have two normally distributed populations $P_1$ and $P_2$, then to test the hypothesis $H_0: \mu_1 = \mu_2$ against an alternative hypothesis, we choose the decision variable according to three cases:

Case 1: If $\sigma_1$ and $\sigma_2$ are known, then regardless whether $n_1$ and $n_2$ are large or small, we consider the standard normal statistic:

$$Z = \frac{\bar X_1 - \bar X_2}{\sqrt{\frac{\sigma_1 ^2}{n_1} + \frac{\sigma_2 ^2 }{n_2}}}$$

Case 2: If the $\sigma$'s are unknown, but $n_1$ and $n_2$ are large, then we consider:

$$Z = \frac{\bar X_1 - \bar X_2}{\sqrt{\frac{S_{X_1} ^2}{n_1} + \frac{S_{X_2}^2}{n_2} }}$$

Case 3: If the $\sigma$'s are unknown and $n_1,n_2$ are small, then we consider the student-t statistic:

$$T = \frac{\bar X_1 - \bar X_2}{\hat \sigma \sqrt{\frac1{n_1} + \frac1{n_2}}}$$

Where $\hat \sigma^2 :=\frac{(n_1 - 1)S_{X_1} ^2 + (n_2 - 1) S_{X_2} ^2 }{n_1 + n_2 - 2}$

Is this correct?

• Identical to this question on stats.SE. The one here should be closed or migrated to stats.SE for merger there. Commented Sep 7, 2015 at 3:40
• I have answered the question here. I am not sure what the etiquette/policy is to copy/paste my answer. Commented Sep 7, 2015 at 3:51
• @TylerHilton: I'll delete my question from there. Commented Sep 7, 2015 at 3:52

You are somewhat correct, but not entirely. When dealing with two population data where the variances are unknown, you must first determine if the population variances are equal or not. This information could be given to you in the question/application or you may need to determine it yourself based on sample data. You can use the F test determine if variances are equal or not. In particular, you are testing $$H_0 : \frac{\sigma_1^2}{\sigma_2^2} = 1 \qquad H_1 :\frac{\sigma_1^2}{\sigma_2^2} \{<, \neq, > \} 1$$ and the $F$-statistic is given by $$F = \frac{s_1^2}{s_2^2}$$ with degrees of freedom $v_1 = n_1 - 1$ and $v_2 = n_2 -2$. Performing this test lets you know whether the population variances are equal or not. Note that this is only applicable when the populations is normally distributed and independent.
In both cases, you are performing the $T$-test.
If the variances are equal $$t = \frac{(X_1 - X_2) - (\mu_1 - \mu_2)}{\sqrt{s_p^2 \left( \frac{1}{n_1} + \frac{1}{n_2} \right)}}$$ where $s_p$ is the pooled variance given by $$s_p^2 = \frac{(n_1 - 1)s_1^2 + (n_2 - 1)s_2^2}{n_1 + n_2 -2}$$ Here, the degrees of freedom is given by $v = n_1 + n_2 -2$.
If population variances are unequal, the test statistic is given by $$t = \frac{(X_1 - X_2) - (\mu_1 - \mu_2)}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}$$ with degrees of freedom given by $$v = \frac{\left( \frac{s_1^2}{n_1} + \frac{s_2^2}{n_2} \right)^2}{\frac{(s_1^2/n_1)^2}{n_1 - 1} + \frac{(s_2^2/n_2)^2}{n_2 -1}}$$ Here, most likely $H_0 : \mu_1 - \mu_2 = 0$.
• I.e., regardless whether $n_1,n_2$ are large or small? Commented Sep 7, 2015 at 3:59
• Yes, when the variances are unknown you use the T test. Remember that choosing the right test statistic requires performing the f-test. To conduct the f-test, the requirement is populations must be normally distributed (and independent). If, indeed, populations are normally distributed, then $n_1, n_2$ doesn't matter. If populations are NOT normally distributed, you'd want your sample sizes $n_1, n_2$ to be large so that you can apply the CLT and thus are able to apply the f-test and continue as above. Commented Sep 7, 2015 at 4:03