# Help needed with confidence interval for proportions please!

I have tried to calculate a 95% confidence interval for proportions on datasets with small and large sample sizes. I have been checking the values with two online calculators and keep getting confidence intervals with negative values or larger than 100% for the data with the small sample size.

Two examples from different datasets:

To calculate a 95% CI using

When n=29 and observed number = 27 CI= 83.88%; 102.32%

when n=61 and observed number = 2 CI= -1.2%; 7.7%

Could anyone suggest what I have done wrong to get these values?

I don't know if you are using R, but the code is very straightforward (below). It will output the confidence intervals based on the Clopper and Pearson (1934) method (see binom.test {stats}).

So in your first example you would end up with:

binom.test(27,29)[4]

$conf.int [1] **0.7723381 0.9915360** attr(,"conf.level") [1] 0.95  while in your second example the output will be: binom.test(2,61)[4]$conf.int
[1] 0.003995603 0.113472167
attr(,"conf.level")
[1] 0.95

• Hi Toni, Thank you for taking the time to recalculate the confidence interval using clopper and pearson method. This is the first time I've tried to calculate a confidence interval and I did not appreciate/understand the value of the various methods. This is really very useful for pointing me in the right direction. Thank you! – Lostinstats Feb 27 '15 at 12:13

If you are using the standard "Wald" confidence interval it is common to get values outside of the possible range (0,100) because it is a symmetric interval.

I highly recommend some more sophisticated confidence intervals which are able to avoid this and have better coverage probability:

http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval

• Thank you very much for explaining why I was getting these values!! I appreciate that you have taken the time to comment and provide feedback and I am now trying other types of confidence interval calculations :) – Lostinstats Feb 27 '15 at 12:09