Difference between two sample means
We now show how earlier results can be applied to independent random samples from two normal distributions, provided they share the same variance,
\[ \begin{align} X_{1,i} \;\;&\sim\;\; \NormalDistn(\mu_1,\;\sigma^2) \qquad \text{for } i=1,\dots,n_1 \\ X_{2,i} \;\;&\sim\;\; \NormalDistn(\mu_2,\;\sigma^2) \qquad \text{for } i=1,\dots,n_2 \end{align} \]The two sample means are independent with normal distributions,
\[ \overline{X}_1 \;\sim\; \NormalDistn\left(\mu_1,\;\frac{\sigma^2}{n_1}\right) \spaced{and} \overline{X}_2 \;\sim\; \NormalDistn\left(\mu_2,\;\frac{\sigma^2}{n_2}\right) \]so their difference also has a normal distribution,
\[ \overline{X}_1 - \overline{X}_2 \;\;\sim\;\; \NormalDistn\left(\mu_1 - \mu_2,\;\sigma^2\left(\frac 1{n_1} + \frac 1{n_2}\right)\right) \]Pooled estimate of variance
In the previous section, we also introduced the pooled estimate of the common variance within the two groups,
\[ S_{\text{pooled}}^2 \;=\; \frac{(n_1 - 1)S_1^2 + (n_2 - 1)S_2^2}{n_1 + n_2 - 2} \]We also showed that the pooled variance has a Chi-squared distribution. For \(g=2\) groups, this can be written as
\[ \frac{n_1 + n_2 - 2}{\sigma^2}S_{\text{pooled}}^2 \;\sim\; \ChiSqrDistn(n_1 + n_2 - 2 \text{ df}) \]Simplifying,
\[ \frac{(n_1 - 1)S_1^2 + (n_2 - 1)S_2^2}{\sigma^2} \;\sim\; \ChiSqrDistn(n_1 + n_2 - 2 \text{ df}) \]We will next show how these results can be used to find a confidence interval for the difference between the means of the two distributions.