TwoTwoSampleSampleTestingTestingforforDifferenceDifferenceofofMeansMeans
Two samples are drawn from two normally distributed populations. We can test the difference between the two means, $\mu_1-\mu_2$. The test procedure depends on whether the variances of the two populations can be presumed to be equal or not.
VariancesVariancespresumedpresumedtotobebeequalequal
We can use a pooled estimate for the common variance $\sigma^2$
$$s_p^2=\frac{\left(n_1-1\right) s_1^2+\left(n_2-1\right) s_2^2}{n_1+n_2-2}$$The test statistic for testing $ \mu_1 - \mu_2 $ is$$t=\frac{\overline{X}_1-\overline{X}_2-\Delta}{s_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}} $$and is t-distributed with ($n_1+n_2-1$) degrees of freedom. Here $\Delta$ is the hypothesized difference between the two population means (typically $0$). The null hypothesis is $H_0: \mu_1-\mu_2=\Delta$ with an alternative one of $H_1: \mu_1-\mu_2 \neq \Delta$,$\; H_1:\mu_1-\mu_2 < \Delta$ or $H_1: \mu_1-\mu_2 > \Delta$.
Stats class is given in two sections, one online and one in person. Here are the results for the final grade averages in the two sections.
$$\begin{array}{|l|c|c|c|} \hline \text{ Online } & n_1=33 & \overline{X}_1=74.6 & s_1^2=211.14 \\ \hline \text{In person} & n_2=28 & \overline{X}_2=81.5 & s_2^2=240.09 \\ \hline \end{array}$$Assuming that the population grades are normally distributed and have the same variance, test $H_0: \mu_1=\mu_2$ versus $H_1: \mu_1< \mu_2$. Use $\alpha=0.05$.$$\begin{aligned} s_p^2 &=\frac{(28-1)(5.2)^2+(33-1)(3.5)^2}{28+33-2}=22.439 \\ s_p&=14.98 \\ &\\t&=\frac{74.6-81.5-0}{14.98 \sqrt{\frac{1}{28}+\frac{1}{33}}}=-1.79 \quad;\quad d.f.=59\end{aligned}$$$p-value=0.039 < \alpha=0.05$. Reject \(H_0 \) and accept \(H_1 \). The final grade averages in the online section are lower.
VariancesVariancesunequalunequal
If the variances of the two normal populations are unequal, we use the test statistic$$t=\frac{\overline{X}_1-\overline{X}_2 - \Delta}{\sqrt{\frac{s^2_1}{n_1}+\frac{s^2_2}{n_2}}} $$which is $t$-distributed with $\nu$ degrees of freedom, where$$ \nu =\frac{\left(\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}\right)^2}{\frac{\left(s_1^2 / n_1\right)^2}{n_1-1}+\frac{\left(s_2^2 / n_2\right)^2}{n_2-1}} $$and round down to the nearest integer. The null hypothesis is $H_0: \mu_1-\mu_2=\Delta$ with an alternative one of $H_1: \mu_1-\mu_2 \neq \Delta$,$\; H_1:\mu_1-\mu_2 < \Delta$ or $H_1: \mu_1-\mu_2 > \Delta$.
The table below contains data on the amounts of arsenic in the drinking water of rural and urban communities:$$\begin{array}{|l|c|c|c|} \hline \text{ Urban communities } & n_1=10 & \bar{x}_1=12.5 & s_1=7.763\,(ppm) \\ \hline \text{Rural communities} & n_2=10 & \bar{x}_2=27.5 & s_2^2=15.3\,(ppm) \\ \hline \end{array}$$Is there a difference in the concentrations of arsenic in drinking water between urban and rural communities? Test at $\alpha=0.05 $ $H_0: \mu_1=\mu_2$ versus $H_1: \mu_1 \neq \mu_2$. Assume that the populations are normally distributed.$$ \begin{aligned} t & =\frac{12.5-27.5}{\sqrt{\frac{(7.63)^2}{10}+\frac{(15.3)^2}{10}}}=-2.27 \\ & \\ \nu & =\frac{\left(\frac{7.63^2}{10}+\frac{15.3^2}{10}\right)^2}{\frac{\left(7.63^2 / 10\right)^2}{10-1}+\frac{\left(15.3^2 / 10\right)^2}{10-1}}=13.2 \quad\Rightarrow \quad d.f.=13\end{aligned} $$$p-value=0.0204 < \alpha=0.05$. Reject $H_0 $ and accept $H_1 $. The arsenic concentration in the water of urban communities is lower than in the water of rural communities.