# What place does $s = \sqrt{\frac{(n_1 - 1)s_1^2 +(n_2 - 1)s_2^2 }{n_1 + n_2 - 2}}$ have in confidence intervals?

I was recently constructing a confidence interval for the difference in population means of two samples ($$\mu_A$$, $$\mu_B$$). Both samples were taken from different populations (e.g. $$A$$ and $$B$$). It was assumed in the question that the standard deviation of both samples was equal.

The 95% confidence interval for $$\mu_A - \mu_B$$ took the form,

$$(\bar{X}_A - \bar{X}_B) \pm s_p\cdot t_{0.975}\cdot\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}$$

where, $$s_p = \sqrt{\frac{(n_1 - 1)s_1^2 +(n_2 - 1)s_2^2 }{n_1 + n_2 - 2}}$$

I was wondering how $$s_p$$ is derived and what it means.

• $s_p$ is the pooled standard deviation of the two samples $x_{A,1},\dots, x_{A,n_1}$ and $x_{B,1},\dots, x_{B,n_1}$. see: en.wikipedia.org/wiki/Pooled_variance for an example and more infos. Sep 9, 2017 at 6:20
• @R.Evet I doubt the question assumed the two samples had the same SD. Rather it assumed both data sets were sampled from populations (distributions) with the same SD. Consider updating the question accordingly. Jan 2, 2023 at 16:28

The standard deviation $s_\mathrm{p}$ is the pooled estimate of the common standard deviation for the two populations. Its square is the pooled estimate of variance, which is an appropriately weighted average of the two sample variances. The weights $n_1-1$ and $n_2-1$ are used instead of $n_1$ and $n_2$ to get the right degrees of freedom. Note that $s^2_1$ is defined as the sum of the squares of the observations minus the sample mean divided by $n_1-1$ and similarly divided by $n_2-1$ for $s^2_2$.