# variance of difference of two means $\bar X-\bar Y$

For the mean of sample $$\bar X$$, $$\frac {\bar X -\mu}{\sigma_X/\sqrt{N}}$$ has normal distribution. According to CLT, $$\bar X$$ has a variance of $$\sigma_x/\sqrt{N}$$.

For two means $$\bar X, \bar Y$$ of two samples, according to $$\bar X-\bar Y=\frac{(X_1+\dots+X_M)-(Y_1+\dots+Y_N)}{M+N}=\frac{M\bar X-N \bar Y}{M+N}$$ would have a deviation of $$\frac { {M \sigma_x^2+N\sigma_y^2}}{(M+N)^2}$$, and so $$\frac {\bar X-\bar Y}{\frac {\sqrt {M \sigma_x^2+N\sigma_y^2}}{M+N}}$$ has a normal distribution, right?

But Data Anal of Life Sci (Michael Love) says that$$\frac {\bar X-\bar Y} {\sqrt {\sigma_x^2/M+\sigma_y^2/N}}$$ has a normal distribution; and that $$\bar X-\bar Y$$ has a variance of $${\sqrt {\sigma_x^2+\sigma_y^2}}/\sqrt N$$. Where does it go wrong?

• It seems that the author sometimes assumes the two sample sizes are N, as here stats.stackexchange.com/q/401214/301417 (but even if so it should be 2$\sqrt N$ in the denominator, right?); sometimes assume that the two sample sizes are M and N separately. Dec 3, 2020 at 16:47
• It's important to pay attention to the context. It's highly likely the second formula is proposed in the context of a hypothesis test; and the specific null and alternative hypotheses are important determinants of a good test statistic.
– whuber
Dec 3, 2020 at 17:15
• Are you assuming both samples have the same mean? When using "normal", do you mean "standard normal"? Dec 3, 2020 at 17:15
• The equality$$\bar X-\bar Y=\frac{X_1+\dots+X_M+Y_1+\dots+Y_N}{M+N}$$is definitely wrong. Dec 3, 2020 at 17:16
• In the last line do you mean deviation instead of variance? Dec 3, 2020 at 17:48

$$\bar X$$ has variance $$\frac{\sigma_x^2}{M}$$ and $$\bar Y$$ has variance $$\frac{\sigma_y^2}{N}$$
If the two samples are independent then $$\bar X - \bar Y$$ has variance $$\frac{\sigma_x^2}{M}+\frac{\sigma_y^2}{N}$$ and standard deviation $$\sqrt{\frac{\sigma_x^2}{M}+\frac{\sigma_y^2}{N}}$$
If then $$M=N$$ then $$\bar X - \bar Y$$ has variance $$\frac{\sigma_x^2+\sigma_y^2}{N}$$ and standard deviation $$\sqrt{\frac{\sigma_x^2+\sigma_y^2}{N}}=\frac{\sqrt{\sigma_x^2+\sigma_y^2}}{\sqrt{N}}$$
• I see it’s $\bar X-\bar Y$, there is no difference in weights (according to sizes of the two samples) of the two variables...or say it’s not weighted sum. Dec 3, 2020 at 17:56
• That is, $\bar X-\bar Y=\frac{(X_1+\dots+X_M)}M-\frac{(Y_1+\dots+Y_N)}N$. I made a mistake here. What I calculated in the post was mean of the two samples put together, i.e. weighted sum of means gotten from two means. Dec 3, 2020 at 17:59