15
$\begingroup$

I'm wondering if someone could let me know if I have calculated the confidence interval for the difference between two proportions correctly.

The sample size is 34, of which 19 are females and 15 are males. Therefore, the difference in proportions is 0.1176471.

I calculate the 95% confidence interval for the difference to be between -0.1183872 and 0.3536814. As the confidence interval passes through zero, the difference is not statistically significant.

Below are my workings out in R, with results as comments:

f <- 19/34
# 0.5588235

m <- 15/34
# 0.4411765

n <- 34
# 34

difference <- f-m
# 0.1176471

lower <- difference-1.96*sqrt((f*(1-f))/n+(m*(1-m))/n)
# -0.1183872

upper <- difference+1.96*sqrt((f*(1-f))/n+(m*(1-m))/n)
# 0.3536814
$\endgroup$
1
  • 1
    $\begingroup$ Your calculations are correct. If you use Rs internal function prop.test, you'll get the same result: prop.test(x=c(19,15), n=c(34,34), correct=FALSE) $\endgroup$ May 26, 2013 at 21:26

3 Answers 3

8
$\begingroup$

My original answer that was accepted by OP assumes a two-sample setting. OP's question deals with a one-sample setting. Hence, @Robert Lew's answer is the correct one in this case.

Original answer

Your formulas and calculations are correct. Rs internal function to compare proportions yields the same result (without continuity correction though):

prop.test(x=c(19,15), n=c(34,34), correct=FALSE)

    2-sample test for equality of proportions without continuity correction

data:  c(19, 15) out of c(34, 34)
X-squared = 0.9412, df = 1, p-value = 0.332
alternative hypothesis: two.sided
95 percent confidence interval:
 -0.1183829  0.3536770
sample estimates:
   prop 1    prop 2 
0.5588235 0.4411765

$\endgroup$
2
  • 1
    $\begingroup$ In the OP, clearly a one sample setting is described. Your solution refers to a two sample setting and therefore seems to be wrong. $\endgroup$
    – Michael M
    Jul 29, 2015 at 19:13
  • 1
    $\begingroup$ @Robert Lew's answer seems to be the correct one in this case. $\endgroup$ Sep 29, 2016 at 5:22
4
$\begingroup$

In this case you have to use a one-sample test, as this is a single sample. Your question boils down to whether males (or females) are one half. Here's how you'd do it using prop.test():

prop.test(x=19, n=34, p=0.5, correct=FALSE)

    1-sample proportions test without continuity correction

data:  19 out of 34, null probability 0.5
X-squared = 0.47059, df = 1, p-value = 0.4927
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
 0.3945390 0.7111652
sample estimates:
    p 
0.5588235 
$\endgroup$
1
$\begingroup$

Thought of small sample sizes, an exact CI can be computed using ExactCIdiff::BinomCI such that:

library(ExactCIdiff)
BinomCI(34,34,19,15)
$conf.level
[1] 0.95

$CItype
[1] "Two.sided"

$estimate
[1] 0.1176

$ExactCI
[1] -0.1107  0.3393
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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