How to calculate a Wilson confidence interval for a proportion
Both 0/20 and 0/200 give an observed rate of 0%. Calculate their two-sided 95% Wilson intervals, work through 1/20, and check the model assumptions.
AcademicFix Editorial Team · Sources reviewed
Bu rehberi Türkçe okuyun- 0/20 observations
- 0%–16.1%
- 0/200 observations
- 0%–1.9%
- Interval type
- Two-sided 95% Wilson
Fictional data. No continuity correction. Both intervals use the same binomial model.
Examine the zero-event examplesSuppose a fictional data check finds no predefined errors in 20 independent records. The observed error rate is 0%, but the two-sided 95% Wilson interval under the binomial model is approximately 0%–16.1%. With no errors in 200 records, it would be 0%–1.9%. The denominator changes the uncertainty accompanying the same observed rate. These results follow by substituting x=0 into the Wilson formula. NIST · Confidence intervals for a proportion · Brown, Cai and DasGupta (2001)
This guide is for authors reporting how many records contain a defined event in a thesis, paper or evaluation report. The calculation assumes equally weighted, independent binary observations with a common event probability. NIST · Binomial model · Kott (2017) · Wilson interval coverage
On this page
Define the event and the unit of observation first
Let n be the number of records examined and x the number containing the predefined event. Code each record as 0 or 1. In the ordinary binomial model, n is fixed, observations are independent, and the event probability p is the same across observations. These are model assumptions required for this calculation. NIST · Binomial model · Brown, Cai and DasGupta (2001)
For repeated measurements on the same person, clustered samples or unequal survey weights, account for the design when estimating the proportion and its variance. Kott’s extension to complex sampling uses a design-appropriate variance and effective sample size. Kott (2017) · Complex sampling · NIST · Binomial model
Find the center and half-width for 1/20
Fictional example. One of 20 independent records contains the event, using the same error definition throughout. The observed proportion is p̂=1/20=0.05, or 5%. For a two-sided 95% interval, use z≈1.959964. The expressions D, c and h below are steps in the Wilson calculation without continuity correction. NIST · Confidence intervals for a proportion · Brown, Cai and DasGupta (2001)
- D = 1 + z²/n ≈ 1.192073.
- Center c = (p̂ + z²/(2n)) / D ≈ 0.122506.
- Half-width h = z × √(p̂(1−p̂)/n + z²/(4n²)) / D ≈ 0.113625.
- The endpoints are c−h and c+h. Expressed as percentages, the interval is approximately 0.89%–23.61%.
The observed 5% differs from the interval center of approximately 12.25%. The Wilson interval is symmetric around c. For comparison, the conventional Wald calculation p̂ ± z√(p̂(1−p̂)/n) gives approximately −4.55%–14.55% here. The negative lower endpoint makes the behavior of that calculation visible in this example. NIST · Confidence intervals for a proportion · Brown, Cai and DasGupta (2001)
Calculate the two-sided interval when no events occur
When x=0, p̂=0. The Wilson formula gives a lower endpoint of 0 and an upper endpoint of z²/(n+z²). For the two-sided 95% calculation, the upper endpoint is approximately 16.11% for 20 observations and 1.88% for 200. These are endpoints of two-sided intervals at the same confidence level. A one-sided 95% upper limit uses a different z value. NIST · Confidence intervals for a proportion · Brown, Cai and DasGupta (2001)
| Events/n | Rate | Lower | Upper |
|---|---|---|---|
| 1/20 | 5.0% | 0.89 | 23.61 |
| 0/20 | 0.0% | 0.00 | 16.11 |
| 0/200 | 0.0% | 0.00 | 1.88 |
Applying the Wald formula to the same x=0 data gives an estimated standard error of zero and an interval of 0%–0%. This algebraic result shows the method’s boundary behavior. The Wilson formula gives a positive upper endpoint for the same example. NIST · Confidence intervals for a proportion · Brown, Cai and DasGupta (2001)
Report the proportion, confidence level and method together
Fictional reporting example. The predefined error occurred in one of 20 independent records (5.0%). The two-sided 95% Wilson score interval for the common event probability, calculated without continuity correction, was 0.89%–23.61%.
The confidence level concerns the coverage behavior of intervals constructed from repeated samples under the same model. The actual coverage of a nominal 95% Wilson interval can vary with sample size and event probability. Brown, Cai and DasGupta (2001) · Kott (2017) · Wilson interval coverage
Check that the reporting sentence reflects your sampling conditions. If you also need to report a difference between percentages, read the percentage points and percent change guide. For interpretation, see the effect sizes and confidence intervals guide. Once the numbers are checked, place them in the APA 7 table formatter.
Check the final table with four questions
The following checklist is an editorial recommendation.
- Are the event definition, x and n stated clearly?
- Do independent observations and a common event probability fit the design?
- Are the two-sided confidence level and interval method specified?
- Do rounding, percentage units and zero-event rows agree with the unrounded calculation?