Statistics & Experimentation
Wilson Score Confidence Interval Formula: Small-Sample & Zero-Defect Proportion Bounds
Compute accurate asymmetric binomial confidence intervals for conversion rates or defect rates using Edwin Wilson’s Score Interval — eliminating negative lower bounds and the 0/n zero-width Wald collapse.
Why textbook p +- 1.96*SQRT(p*(1-p)/n) fails catastrophically at 0 defects or small n!
When 0 defects appear in n = 20 medical device inspections (p_hat = 0), the textbook normal Wald formula p +- z*SQRT(p*(1-p)/n) produces [0.00%, 0.00%] — falsely asserting 0% defect risk from just 20 units! Near low conversion rates (e.g., 1/40 = 2.5%), Wald even outputs impossible negative lower bounds (-2.3%)!
Edwin Bidwell Wilson’s (1927) Score Interval inverts the exact binomial test statistic without plugging p_hat into the denominator alone: Bounds = ((p + z^2/(2n)) +- z * SQRT((p*(1-p)/n) + z^2/(4*n^2))) / (1 + z^2/n). At 0 / 20 and z = 1.96, Wilson yields [0.00%, 16.11%] — rigorously bounding true risk inside [0%, 100%] for every x and n!
| Sample Outcome (95% CI, z = 1.96) | Broken Wald Interval | Exact Wilson Score Interval |
|---|---|---|
| 0 defects in n = 20 (p = 0.0%) | [0.00%, 0.00%] (Dangerous illusion!) | [0.00%, 16.11%] |
| 4 conversions in n = 20 (p = 20.0%) | [2.47%, 37.53%] (Symmetric distortion) | [8.07%, 41.60%] (Asymmetric toward 50%) |
Wilson Score Upper Confidence Bound (%)
Computes 100 * Wilson Upper Bound for x successes/defects (B2), n trials (B3), and critical z (B4, e.g., 1.96 for 95%).
=IF(OR(B3 <= 0, B2 < 0, B2 > B3, B4 <= 0), "Invalid Binomial Sample Inputs", ROUND(100 * (((B2 / B3) + (B4 ^ 2) / (2 * B3)) + B4 * SQRT(((B2 / B3) * (1 - B2 / B3) / B3) + (B4 ^ 2) / (4 * (B3 ^ 2)))) / (1 + (B4 ^ 2) / B3), 2))Wilson Score Lower Confidence Bound (%)
Computes 100 * Wilson Lower Bound (clamped with MAX(0, ...) against 1e-16 floating-point rounding at x = 0).
=IF(OR(B3 <= 0, B2 < 0, B2 > B3, B4 <= 0), 0, ROUND(MAX(0, 100 * (((B2 / B3) + (B4 ^ 2) / (2 * B3)) - B4 * SQRT(((B2 / B3) * (1 - B2 / B3) / B3) + (B4 ^ 2) / (4 * (B3 ^ 2)))) / (1 + (B4 ^ 2) / B3)), 2))Try the example
Use the original values or change them to test your understanding.