Tutorials › Introduction to Statistics › When the Wald Interval Fails Near a Boundary

Confidence Intervals for Proportions · Tutorial 570 of 996

When the Wald Interval Fails Near a Boundary

Learn to diagnose boundary problems in Wald intervals and calculate and interpret a Wilson score interval for a population proportion.

Intermediate 10 min read

What You'll Learn

  • Identify why Wald intervals can be unreliable when the sample proportion is near zero or one.
  • Check the Bernoulli sampling assumptions behind proportion intervals.
  • Derive the Wilson score interval by inverting a score test.
  • Calculate Wilson limits from a number of successes and a sample size.
  • Compare Wald and Wilson results and interpret their limits in context.

Why Boundary Proportions Need Care

A confidence interval for a population proportion should reflect uncertainty about an unknown proportion \(p\), which must lie between 0 and 1. The familiar Wald interval uses the sample proportion \(\hat{p}\) as its estimate of \(p\), and also uses \(\hat{p}\) to estimate the standard error. When the observed proportion is close to either boundary, that estimated standard error can be misleadingly small. The resulting interval may extend below 0 or above 1, or, in an extreme case, have zero width.

The Wald interval is not automatically unusable whenever \(\hat{p}\) is somewhat near a boundary. The concern is that its normal approximation can perform poorly when the data contain few successes or few failures. The Wilson score interval is a widely used alternative. It is based on the same binomial model but handles uncertainty near the boundaries more reliably.

Model: Each observation is a success or failure, the sample size \(n\) is fixed, and the observations are independent with the same probability \(p\) of success. If \(X\) is the number of successes, then \(X\sim\operatorname{Binomial}(n,p)\) and \(\hat{p}=X/n\). In an application, the sampling design must support treating observations as random and independent; for sampling without replacement, the usual independence approximation requires the sample to be a small fraction of the population.

The Wald Interval and Its Boundary Problem

For a two-sided confidence interval with confidence level \(1-\alpha\), let \(z^*\) be the standard normal critical value with central probability \(1-\alpha\). The Wald interval is

$$ \hat{p}\ \pm\ z^*\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}. $$

Its estimated standard error is \(\sqrt{\hat{p}(1-\hat{p})/n}\). This plug-in estimate is convenient, but it can be unstable near the boundaries. In particular, if \(X=0\), then \(\hat{p}=0\) and the estimated standard error is zero; the interval is just \([0,0]\), regardless of the sample size. Observing no successes does not establish that the population success probability is exactly zero. Likewise, when \(X=n\), the Wald interval is just \([1,1]\).

Even when the observed count is not exactly zero or \(n\), the Wald interval can have a negative lower limit or an upper limit greater than 1. Those values are impossible for a population proportion and signal that the approximation is not behaving well. Simply truncating such an interval to \([0,1]\) does not fix the underlying problem with its coverage. The Wilson score interval addresses the problem through a different construction.

Worked Example: One Success in a Small Sample

Suppose a hypothetical independent sample of \(n=20\) people contains \(X=1\) person with a specified characteristic. Calculate a 95% Wald interval and check whether it is plausible.

The sample proportion is \(\hat{p}=1/20=0.05\). For 95% confidence, use \(z^*=1.96\). The Wald standard error is

$$ SE=\sqrt{\frac{0.05(1-0.05)}{20}} =\sqrt{0.002375} \approx 0.04873. $$

The margin of error is \(1.96(0.04873)\approx 0.09552\), so the interval is

$$ 0.05\pm0.09552 \quad\Longrightarrow\quad (-0.04552,\ 0.1455). $$

The lower limit is negative, which is impossible for a population proportion. Here there is only one success, so the normal approximation behind the Wald procedure is especially questionable. This calculation is a warning to use a more suitable interval, not a reason to interpret a negative proportion.

Deriving the Wilson Score Interval

The Wilson interval is obtained by asking which candidate population proportions \(p_0\) are consistent with the observed data under a score-test criterion. For a candidate \(p_0\) strictly between 0 and 1, the standardized score statistic is

$$ \frac{\hat{p}-p_0}{\sqrt{p_0(1-p_0)/n}}. $$

A two-sided score test at critical value \(z^*\) does not reject \(p_0\) when the absolute value of this statistic is at most \(z^*\). Inverting the test means keeping all candidate values \(p_0\) that satisfy this inequality; the resulting set is the confidence interval. Squaring both sides and substituting \(p\) for the candidate value gives

$$ \frac{(\hat{p}-p)^2}{p(1-p)/n}\le (z^*)^2 \quad\Longleftrightarrow\quad n(\hat{p}-p)^2\le (z^*)^2p(1-p). $$

Expanding and collecting terms in \(p\) gives a quadratic inequality:

$$ (n+(z^*)^2)p^2- \bigl(2n\hat{p}+(z^*)^2\bigr)p+ n\hat{p}^{\,2}\le 0. $$

Because the coefficient of \(p^2\) is positive, the values satisfying the inequality lie between the two roots. Applying the quadratic formula and simplifying those roots gives the Wilson limits:

$$ \frac{\hat{p}+\dfrac{(z^*)^2}{2n} \ \pm\ z^*\sqrt{\dfrac{\hat{p}(1-\hat{p})}{n} +\dfrac{(z^*)^2}{4n^2}}} {1+\dfrac{(z^*)^2}{n}}. $$

The plus sign gives the upper limit and the minus sign gives the lower limit. This inversion explains why the Wilson formula includes \(p\)-dependent uncertainty in the test statistic rather than estimating the standard error solely by plugging \(\hat{p}\) into it. The interval is an approximate, nominal confidence interval, not an exact guarantee of coverage in every sample.

Wilson score interval: For a binomial sample with \(X\) successes out of \(n\), set \(\hat{p}=X/n\) and choose \(z^*\) for the desired two-sided confidence level. The interval has lower and upper limits $$ \frac{\hat{p}+\dfrac{(z^*)^2}{2n} \ \pm\ z^*\sqrt{\dfrac{\hat{p}(1-\hat{p})}{n} +\dfrac{(z^*)^2}{4n^2}}} {1+\dfrac{(z^*)^2}{n}}. $$

Calculating and Interpreting Wilson Limits

The following examples use 95% confidence, so \(z^*=1.96\) and \((z^*)^2=3.8416\). The same calculation applies at other confidence levels after choosing the corresponding critical value. Check that the model and sampling assumptions are reasonable before interpreting the interval: the formula does not repair a biased sample or dependence that was ignored in the design.

Worked Example: No Successes Observed

In a hypothetical independent sample of \(n=30\) people, suppose there are no observed successes, so \(X=0\) and \(\hat{p}=0\). Compare the Wald result with the 95% Wilson interval.

The Wald standard error is \(\sqrt{0(1-0)/30}=0\), giving the interval \([0,0]\). That result claims no sampling uncertainty despite there being only 30 observations.

For the Wilson calculation, the center and half-width are

$$ \text{center} =\frac{0+3.8416/(2\cdot30)}{1+3.8416/30} \approx 0.05676, $$
$$ \text{half-width} =\frac{1.96\sqrt{0+3.8416/(4\cdot30^2)}}{1+3.8416/30} \approx 0.05676. $$

Thus the Wilson interval is approximately \([0,\ 0.1135]\). In this boundary case the lower limit is zero, while the upper limit is positive: the sample provides evidence compatible with a small success probability, but does not rule out all positive values. For these data and assumptions, we are 95% confident that the population proportion is between 0 and about 0.1135.

Worked Example: Comparing Intervals Away From the Boundary

Suppose a hypothetical independent sample of 40 people has 8 successes. Then \(\hat{p}=8/40=0.20\). Calculate both 95% intervals to see how the methods compare when the observed proportion is less extreme.

For the Wald interval,

$$ SE=\sqrt{\frac{0.20(0.80)}{40}}=\sqrt{0.004}\approx0.06325, \qquad ME=1.96(0.06325)\approx0.1240. $$

The Wald limits are \(0.20-0.1240=0.07604\) and \(0.20+0.1240=0.3240\), approximately \([0.07604,\ 0.3240]\).

For Wilson, the denominator is \(1+3.8416/40=1.09604\). The center is

$$ \frac{0.20+3.8416/(2\cdot40)}{1.09604} =\frac{0.24802}{1.09604} \approx0.2263, $$

and the half-width is

$$ \frac{1.96\sqrt{0.20(0.80)/40+3.8416/(4\cdot40^2)}}{1.09604} = \frac{1.96\sqrt{0.00460025}}{1.09604} \approx0.1213. $$

The Wilson interval is therefore approximately \([0.1050,\ 0.3476]\). Both intervals are within the possible range, but they are not identical: Wilson accounts for the score-test construction and is not required to be centered at \(\hat{p}\). The 95% Wilson interval estimates the population proportion of people with the specified characteristic, not the proportion in some other population or time period.

When to Use Wilson and What to Watch For

The Wald interval is simple, and it may be adequate when both successes and failures are numerous enough for the normal approximation to be dependable. Near a boundary, however, the Wilson interval is generally a more stable choice. It remains within \([0,1]\) and avoids the zero-width Wald result at \(X=0\) or \(X=n\). For example, when \(X=0\), its upper limit simplifies to \((z^*)^2/(n+(z^*)^2)\), which is positive for a finite positive sample size.

An interval method cannot compensate for flaws in how data were collected. Wilson limits do not make a convenience sample representative, make dependent observations independent, or remove measurement error. State the population and outcome clearly, and verify that the binomial sampling model is plausible before interpreting the numerical limits.

Common pitfall: A learner sees a negative Wald lower limit and replaces it with zero, or sees \(X=0\) and reports the Wald interval \([0,0]\) as proof that \(p=0\). Neither conclusion follows. The first changes the interval after calculation without correcting its approximation; the second mistakes no observed successes for certainty about the population. Use a suitable method such as Wilson near a boundary, and interpret its limits as estimates with sampling uncertainty.
Key takeaway: When \(\hat{p}\) is near 0 or 1, inspect the Wald interval rather than applying it automatically. A Wilson score interval is formed by inverting a score test, is usually more reliable near the boundaries, and still depends on sound sampling assumptions.

Check Your Understanding

Answer these questions using the definitions and methods above.

  1. What happens to the Wald standard error and interval when \(X=0\)? Why is that result concerning?
  2. For a two-sided 95% Wilson interval, what value of \(z^*\) is used, and what is the role of that critical value?
  3. In the Wilson derivation, what does it mean to invert the score test?
  4. Why is truncating a negative Wald lower limit to zero not, by itself, a solution to the boundary problem?
  5. A hypothetical sample has \(n=50\) and \(X=49\). What feature of the Wald interval should you check before interpreting it, and which alternative interval could you calculate?