Signature
p_hat = r / n; m_W = p_hat + z^2 / (2 * n); h_W = z * sqrt(p_hat * (1 - p_hat) / n + z^2 / (4 * n^2)); d_W = 1 + z^2 / n; L_Wilson = (m_W - h_W) / d_W; U_Wilson = (m_W + h_W) / d_W
| Inputs | Definition | Unit |
|---|---|---|
r | Number of patients with the event | patients |
n | Number of patients in the study | patients |
z | Standard normal quantile for the chosen confidence level, 1.96 for a 95% interval | none |
p_hat | Observed proportion r/n | probability |
|---|---|---|
m_W | Centre term before division, p_hat plus z squared over 2n | probability |
h_W | Half-width term before division | probability |
d_W | Denominator, one plus z squared over n | none |
L_Wilson | Lower limit of the Wilson interval for p | probability |
U_Wilson | Upper limit of the Wilson interval for p | probability |
Function
Binomial distribution of an event count among patients at risk
Gives the probability that exactly r of n patients have an event within a fixed period when each patient has the same probability p of the event and outcomes are independent. Read as a function of p for an observed count, the same expression is the binomial likelihood, proportional to p^r (1 minus p)^(n minus r), which peaks at the observed proportion r/n. The formulae below give the probability function, the chance of a zero count, the mean and variance of the count, the estimated probability with its standard error, the Wald and Wilson intervals and the logit model for binomial data in NICE DSU evidence synthesis. The conjugate beta update of a binomial probability is set out on the Beta Distribution page (HE-FM-BETA-002), and the general Wald interval for any estimate on the Asymptotic Normality page (HE-FM-AN-001).
Try this function
Implementations
Excel
Binomial Wilson interval limits in two cells
With named cells PHat, Z and Patients, the two formulas return the lower and upper Wilson limits.
=(PHat+Z^2/(2*Patients)-Z*SQRT(PHat*(1-PHat)/Patients+Z^2/(4*Patients^2)))/(1+Z^2/Patients); =(PHat+Z^2/(2*Patients)+Z*SQRT(PHat*(1-PHat)/Patients+Z^2/(4*Patients^2)))/(1+Z^2/Patients)
Assumptions
Binomial count behind the Wilson score interval
The interval inverts the large-sample test for a binomial proportion, so it still rests on the binomial conditions of a fixed denominator, a common probability and independent outcomes.
Worked examples
Wilson interval for 6 adverse events among 40 patients
With z squared of 3.8416, the centre term is 0.1980, the half-width term 0.1206 and the denominator 1.0960, giving about 0.0706 to 0.2907. The interval is shifted upwards from the Wald interval and asymmetric about 0.15, as in the article's step 2.
r = 6; n = 40; z = 1.96; p_hat = 0.15; m_W = 0.1980; h_W = 0.1206; d_W = 1.0960; L_Wilson = 0.0706; U_Wilson = 0.2907
Wilson interval for no events among 40 patients
The half-width term equals the centre term, about 0.0480, so the interval runs from 0 to about 0.0876: no events among 40 patients is consistent with an annual probability of up to about 9%, the article's step 3.
r = 0; n = 40; z = 1.96; p_hat = 0; m_W = 0.0480; h_W = 0.0480; d_W = 1.0960; L_Wilson = 0; U_Wilson = 0.0876
Common errors
Wilson terms not divided by the denominator
Omitting the division by d_W gives about 0.0774 to 0.3186 for 6 events among 40 patients instead of 0.0706 to 0.2907, an interval that is too wide and shifted upwards.
Sources
NIST formulas for the Wilson interval for a proportion
NIST/SEMATECH. e-Handbook of Statistical Methods. Section 7.2.4.1, Confidence intervals for a proportion. National Institute of Standards and Technology; accessed 2 October 2026. Gives the upper and lower Wilson limits, based on inverting the large-sample test for a proportion, with the centre p_hat plus z squared over 2n, the square-root term and the denominator 1 plus z squared over n, and notes that the lower limit cannot be negative.
Recommendation of the Wilson interval for small samples
Brown LD, Cai TT, DasGupta A. Interval estimation for a binomial proportion. Statistical Science. 2001;16(2):101-133. Abstract, which recommends the Wilson interval or the equal-tailed Jeffreys prior interval for small n.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0