Binomial || Poisson || Set Conf Levels
This page computes exact confidence intervals for samples from the Binomial and Poisson distributions.
By default, it calculates symmetrical 95% confidence intervals, but you can change the "tail areas" to anything you'd like.
The formulas used in this web page are also available as Excel macros, which you can download in the file: confint.xls (85k long). This spreadsheet now includes an extra page that can generate a customized table of confidence limits around the observed numerator (x) and around the observed proportion (x/N), for any value of the denominator (N). My thanks to Prof. Patrick J. Laycock (University of Manchester) for that enhancement.
If you would like to have the six functions (BinomLow, BinomHigh, BinomP, PoisLow, PoisHigh, and PoisP) which appear in this spreadsheet available all the time (just as if they were built-in Excel functions), you can download and install the confint.xla Excel "add-in". Save the downloaded file in some reasonably "permanent" location on your computer's hard disk. Then install it, using the appropriate steps for your version of Excel (see Excel's Help section for "add-ins").
Note: Before using this page for the first time, make sure you read the JavaStat user interface guidelines for important information about interacting with JavaStat pages.
Enter the observed numerator and denominator counts, then click the Compute button:
Numerator (x):
Denominator (N):
Proportion (x/N):
Exact Confidence Interval around Proportion:
to
Enter the number of observed number of events, then click the Compute button:
Observed Events:
Exact Confidence Interval around Mean Event Rate:
Normally you will not need to change anything in this section. People usually use symmetrical 95% confidence intervals, which correspond to a 2.5% probability in each tail. If you want a different confidence level, you can replace the 95 with your preferred level, then click the Compute button. The program will split the tail area evenly between the Lower and Upper tails.
If you want asymmetrical limits, you can change the % Area numbers in the Lower Tail and Upper Tail cells shown below, then click the Compute button. The program will adjust the Confidence Level level accordingly.
Confidence Level:
% Area in Upper Tail:
% Area in Lower Tail:
Note: Over the years, I have grappled with the issue of whether or not any special action has to be taken , in computing the classic Clopper-Pearson binomial confidence intervals, when the observed count falls at one or the other end of the range of possible values (such as when the observed "Numerator" is equal to zero, or equal to the "Denominator" for the binomial case, or when the "Observed Events" is zero for the Poisson case). Specifically, the question arises as to whether, in such a situation, the confidence interval should be made one-sided; that is, should all of the 5% tail probability (for 95% CI's) be put onto one side, instead of being split half-and-half between the left and right side. The rationale for taking such action is that, in these situations, one side of the CI will be equal to the observed value (that is, there will be no "confidence region" on that side), so it would seem to make sense that all of the tail area should be re-allocated over to the other side, giving a slightly narrower confidence interval.
In the original version of this page (and the corresponding Excel spreadsheet), I took no special action. So, for example, an observed event count of zero would result in a 95% Poisson CI of 0 to 3.689 . But over the years, people pointed out that the one-sided 95% Poisson CI for an observed count of 0 was 0 to 2.996, so on June 19, 2004, I revised this web page to apply this one-sided adjustment automatically whenever the observed Poisson count was zero, or whenever the observed binomial numerator was zero or equal to the denominator. I also revised the Excel spreadsheet (and the included macros) to do the same thing.
Then in 2007, in a series of e-mail communications with Karl Schlag (of the Economics Department, European University Institute, in Florence, Italy), I came to realize that this special action was not justified -- It is not valid for the CI algorithm to turn a 2-sided CI into a 1-sided CI "on the fly" for certain values of the observed value. Taking this special action produces a CI that, for certain ranges of the true parameter, fails to produce at least a 95% coverage probability, thereby violating the strict requirement for an exact CI. The decision to use a 1-sided or a 2-sided CI has to be made beforehand, and applied consistently no matter what the observed value turns out to be. So, on August 11, 2007, I changed the web page's algorithm back to the way it was prior to June 19, 2004. I also made the same changes to the Excel spreadsheet and its macros.
Reference: CJ Clopper and ES Pearson, "The use of confidence or fiducial limits illustrated in the case of the binomial." Biometrika 26:404-413, 1934.
Reference: F Garwood, "Fiducial Limits for the Poisson Distribution" Biometrica 28:437-442, 1936.