# Difference of means of Binomial variables

If the formula for a hypothesis test is

$$z = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\frac{\sigma^2_{x_1}}{n_{x_1}} + \frac{\sigma^2_{x_2}}{n_{x_2}}}}$$

And the variance for a binomial variable is given by the equation

$$\sigma^2 = np(1-p)$$

Then why is the sum of the variances given by

$$\sigma_{x_1 - x_2} = \sqrt{\frac{p_1(1-p_1)}{n_{x_1}} + \frac{p_2(1-p_2)}{n_{x_2}}}$$

Rather than

$$\sigma_{x_1 - x_2} = \sqrt{p_1(1-p_1)+ p_2(1-p_2)}$$

• When you divide a random variable by $n$ you divide its variance by $n^2$ Oct 3, 2016 at 4:16

The correct formulas are $$\text{st.dev}\left(\frac{x_1}{n_{x_1}}+\frac{x_2}{n_{x_2}}\right)=\sqrt{\frac{p_1(1-p_1)}{n_{x_1}}+\frac{p_2(1-p_2)}{n_{x_2}}}$$ and $$\text{st.dev}\left(x_1+x_2\right)=\sqrt{p_1(1-p_1)+p_2(1-p_2)}.$$ Let me derive the first formula: $$\text{st.dev}\left(\frac{x_1}{n_{x_1}}+\frac{x_2}{n_{x_2}}\right)=\sqrt{\text{var}\left(\frac{x_1}{n_{x_1}}\right)+\text{var}\left(\frac{x_2}{n_{x_2}}\right)}$$ and because $$\text{var}\left(\frac{x}{n_{x}}\right)=\frac{1}{n^2}\text{var}\left(x\right)=\frac{p(1-p)}{n}$$ you get the first formula.