Here's the question: A survey of 500 males and 700 females showed that 132 males and 226 females agreed with a particular statement. Use this information to calculate the proportions of males and females that agreed with the statement. This will give you the values for p1 and p2. Use this to calculate q1 and q2. Now calculate the standard error of the difference between two independent proportions. Then determine the confidence interval for the difference between two independent proportions for the 95 confidence level.

I think my formulas are wrong because they're not the standard error of the difference between two independent proportions or the confidence interval for the difference between two independent proportions like what these charts show, I have the specific bottom equation zoomed in. I'm still unsure what the q1 and q2 refers to.

enter image description here

enter image description here

Here's what I have for formulas so far:

p1 = 0.264 (132/500)
p2 = 0.322857 (226/700)
q1 = 
q2 =

Stdev1 = sqrt (p(1-p)) = (1-0.264)*0.264 = sqrt(0.194304) = 0.44079927404
Stdev2 = sqrt(p(1-p)) = (1-0.322857)*0.322857 = sqrt(0.218620357) = 0.4675685586

Std error = standard deviation / square root(number of samples)
Std error1 = 0.44079927404/sqrt(500) = 0.44079927404/22.360679775 = 0.019713142
Std error2 = 0.4675685586/sqrt(700) = 0.4675685586/26.4575131106 = 0.017672430

Standard deviation = in R it’s sd() and in sd you need series of values, 
    m = mean of values
    x – m = difference of values minus mean
    sum of squared diff from the mean = sum(x-m)^2
    square root [(sum of squared diff from the mean) / (sample size -1)]

Confidence interval (95%)  = 
    Margin of error = Square root [p(1-p)/n]  * 1.96  //n = sample size, 1.96 is 95% confidence interval
    Margin error1 = sqrt(0.194304/500)   * 1.96  = 0.01971314282  * 1.96 = 0.038637759 
    Margin error2 = sqrt(0.218620357/700) ] * 1.96 = 0.01767240787  * 1.96 = 0.034637919 
    P + margin of error = Upper confidence interval
        p1 = 0.264+0.038637759 = 0.302637759
        p2 = 0.322857 + 0.034637919 = 0.35749419
    P – margin of error = Lower confidence interval
        p1 = 0.264-0.038637759 = 0.225362241
        p2 = 0.322857 - 0.034637919 = 0.288219081

    P1 CI =  0.225362241 <  0.264 < 0.302637759
    P2 CI =  0.288219081 < 0.322857 < 0.35749419
  • $\begingroup$ $q_1$ is just $1-p_1$. I am not sure what you think is wrong with the formula for estimated standard error that you highlighted ($\sqrt{\frac{p_1q_1}{n_1}+\frac{p_2q_2}{n_2}}$). $\endgroup$
    – Glen_b
    Oct 10, 2021 at 23:43
  • $\begingroup$ that's the formula for the standard error of a difference between two independent proportions and the one next to it is the confidence interval difference between two independent proportions, it's highlighted because that's how you solve this question and that's what this question is about @Glen_b $\endgroup$ Oct 10, 2021 at 23:57
  • $\begingroup$ You say in your question "they're not the standard error of the difference between two independent proportions..." (which as far as I can see is the exact opposite of what you just said in your comment). Why do you say that in the question? $\endgroup$
    – Glen_b
    Oct 11, 2021 at 6:42
  • $\begingroup$ It says I think they're wrong because they're not the difference, and if you look at my formulas they're wrong because they're not the difference. @Glen_b $\endgroup$ Oct 12, 2021 at 16:14
  • $\begingroup$ The formula for the variance of a difference does not itself involve a difference of variances ("variance of" and "difference of" are not transitive operations). Indeed that it should not is obvious, since you'd regularly get negative variances, which is impossible. (You take square roots of variances to get standard errors) $\endgroup$
    – Glen_b
    Oct 12, 2021 at 21:34

2 Answers 2


Confidence intervals for men and women separately. Let capital letters denote estimates: The point estimates for the proportions of men and of woman who agree are $0.264$ and $0.323,$ respectively. The corresponding Wald confidence intervals, based on normal approximation, are $(0.225, 0.303)$ for men and $(0.288, 0.357)$ for women.

P.m = 132/500;  P.m
[1] 0.264
SE.m = sqrt(P.m*(1-P.m)/500);  SE.m
[1] 0.01971314
CI.m = P.m + qnorm(c(.025,.975))*SE.m
[1] 0.225363 0.302637

P.w = 226/700; P.w
[1] 0.3228571
SE.w = sqrt(P.w*(1-P.w)/700);  SE.w
[1] 0.01767243
CI.w = P.w + qnorm(c(.025,.975))*SE.w
[1] 0.2882198 0.3574945

The procedure binom.test in R gives (slightly different) exact binomial confidence intervals, $(0.226, 0.305)$ for men and $(0.288, 0.359)$ for women, as shown below.

[1] 0.2258560 0.3049604
[1] 0.95
[1] 0.2883144 0.3589013
[1] 0.95

CI for the difference between men and women.

As in the last section of the table in your question and in @Ben's Answer (+1), the (estimated) standard error for the difference P_w - P_m is as follows:

SE.d = sqrt(SE.w^2 + SE.m^2);  SE.d
[1] 0.02647495

Then a 95% confidence interval for the difference, based on normal approximations, is (0.0070, 0.1107),$ which is essentially the same

P.w-P.m + qnorm(c(.025,.975))*SE.d
[1] 0.006967198 0.110747087

In R the procedure prop.test gives the same 95% confidence interval $(0.0070, 0.1107).$ [This interval is also based on a normal approximation; the continuity correction was declined on account of the large sample sizes.]

prop.test(c(226,132), c(700,500), cor=F)$conf.int
[1] 0.006967198 0.110747087
[1] 0.95

Notice that this 95% confidence interval does not include $0.$ Accordingly, a test the women and men have equally favorable opinions is rejected at the 5% level (against the two-sided alternative). The P-value of the (approximate normal) test is $0.028 < 0.05 = 5\%.$

prop.test(c(226,132), c(700,500), cor=F)$p.val
[1] 0.02802182
  • 2
    $\begingroup$ Thanks! Looks like my manual calculations were correct when I was doing the individual standard errors and confidence intervals but I didn't understand how to do the difference, now I have some extra R code too for future reference, this really helped a lot! $\endgroup$ Oct 10, 2021 at 23:17
  • $\begingroup$ Edited to show numerical values of (estimated) standard errors. $\endgroup$
    – BruceET
    Apr 7 at 16:10

In order to understand this material, you should read about the properties of the variance operator. This is a quadratic operator, which operates in a specific way on linear functions of random variables. Once you understand the algebraic rules for the way this operator works, you will be able to see how to get the variance of differences between random quantities.

For completeness, I will go through the working here. Suppose we let $\hat{p}_1 = x_1/n_1$ and $\hat{p}_2 = x_2/n_2$ be the observed sample proportions, where $x_1 \sim \text{Bin}(n_1,p_1)$ and $x_2 \sim \text{Bin}(n_2,p_2)$ are binomial random variables. Assuming that these are from independent samples, using the rules for the variance operator, the true variance of the difference in proportions is:

$$\begin{align} \mathbb{V}(\hat{p}_1-\hat{p}_2) &= \mathbb{V} \Big( \frac{x_1}{n_1} - \frac{x_2}{n_2} \Big) \\[6pt] &= \mathbb{V} \Big( \frac{x_1}{n_1} \Big) + \mathbb{V} \Big( -\frac{x_2}{n_2} \Big) \\[6pt] &= \mathbb{V} \Big( \frac{x_1}{n_1} \Big) + (-1)^2 \mathbb{V} \Big( \frac{x_2}{n_2} \Big) \\[6pt] &= \mathbb{V} \Big( \frac{x_1}{n_1} \Big) + \mathbb{V} \Big( \frac{x_2}{n_2} \Big) \\[6pt] &= \frac{\mathbb{V}(x_1)}{n_1^2} + \frac{\mathbb{V}(x_2)}{n_2^2} \\[6pt] &= \frac{n_1 p_1 (1-p_1)}{n_1^2} + \frac{n_2 p_2 (1-p_2)}{n_2^2} \\[6pt] &= \frac{p_1 (1-p_1)}{n_1} + \frac{p_2 (1-p_2)}{n_2} \\[6pt] &= \frac{p_1 q_1}{n_1} + \frac{p_2 q_2}{n_2}. \\[6pt] \end{align}$$

Consequently, the true "standard error" of the estimator (the standard deviation of the difference between sample proportions) is:

$$\begin{align} \text{se} = \sqrt{\mathbb{V}(\hat{p}_1-\hat{p}_2)} &= \sqrt{\frac{p_1 q_1}{n_1} + \frac{p_2 q_2}{n_2}}, \\[6pt] \end{align}$$

and the "estimated standard error" (using the standard estimate) is:

$$\begin{align} \hat{\text{se}} &= \sqrt{\frac{\hat{p}_1 \hat{q}_1}{n_1} + \frac{\hat{p}_2 \hat{q}_2}{n_2}}. \\[6pt] \end{align}$$

If you have a look at the working above, you will see that the negative since that occurs in the difference in proportions does not affect the variance. This is because taking the negative of a random variable just changes its direction and not its variance. Mathematically, this property is a consequence of the fact that constants inside the variance operator come out of the operator squared.

  • $\begingroup$ Thanks! That explains the diagram in the chart. In the last steps where it goes from p1(1−p1) to p1q1 what is the q representing? Is n either the 500 or 700 sample size, and would the variables with hats p^ be the observed yes answers, so 132, with p being 500? $\endgroup$ Oct 10, 2021 at 21:40
  • 2
    $\begingroup$ For binomial distributions, many authors use $q = (1-p).$ In the last panel of the table in your Question, it seems that equal sample sizes are used. @Ben's equations (using $n_1$ and $n_2)$ and my computations took the different sample sizes into account $\endgroup$
    – BruceET
    Oct 10, 2021 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.