Confidence intervals for the difference between two proportions

This is set up as a comparison of your sample with a reference value. However, it can be used to compare any two independent samples. (If you are comparing two proportions in the same sample, i.e. of two different categoricals, you need a different test/CI which I may get round to putting up here later.)
Your sample Reference proportion
Your numerator (those who were positive or had the attribute of interest):
There are two ways to input the reference data:
Either enter the reference numerator:
or else the reported reference proportion:
Your denominator (i.e. your total n): Reference denominator:
Confidence interval you want (usually 95%):
Decimal places you want for the answers:
This program runs within R ( R is a brilliant open source (i.e. free) statistics package derived from S and related to the equally excellent but not cheap commercial product S+ (

Brilliant though R is, it's a huge package and to run this, my webserver software has to launch R and both run on some fairly old hardware on the end of an ADSL link so it will take a minute or two come back to you with the answer.

Please also note that I accept no responsibility for this script's results. I have enormous faith in R and programming this was trivial but if anything major depends on this, then you need to pay for good statistical support locally.

If you do find an error or problems here tell me!
All access is logged for IP address, time/date and parameters entered so I can track any abuse of the server.

Licensing and copying
You can download script that runs this

You will need to understand a bit about R and have Frank E. Harrell Jr.'s Hmisc package and David Firth's CGIwithR package to make the script or a derivative of it work on your own server.

Like almost everything on this website this work is licensed under a Creative Commons License.

Creative Commons License