Confidence sets and test inversion
Construct confidence procedures by retaining nonrejected parameter values and interpret coverage as a repeated-experiment guarantee.
On this page
The question for today
What you’ll understand
- Define coverage for a random confidence set.
- Prove the duality between nonrandomized level tests and confidence sets.
- Compare exact and approximate intervals in continuous and discrete models.
A point estimate compresses the result of an experiment to one value, but usually leaves many parameter values compatible with the observed uncertainty. A confidence procedure returns a data-dependent set together with a coverage guarantee over repetitions of the specified experiment. Test inversion constructs such a set by asking, for each candidate value, whether a calibrated test would reject it. The logic is simple and general; the shape need not be a symmetric interval, and the interpretation is a property of the procedure rather than a probability distribution assigned to a fixed unknown parameter.
The set is random before data arrive
A confidence set for has coverage at least when for every parameter value in the model. The randomness is in the data and therefore the set. After observing a particular set, its inclusion of the fixed true parameter is already determined, though unknown to us. A Bayesian credible region answers a different conditional probability question under a prior and posterior. Equal numerical endpoints in a special model do not make the two guarantees identical.
Coverage is conditional on the sampling model, including dependence, stopping, missingness, and any selection rules used in the analysis. A nominal confidence level printed by software does not establish those assumptions. A procedure with valid marginal coverage can also cover poorly within some data-defined subgroups; the guarantee does not automatically hold after arbitrary conditioning on the observed width or a selection event. Report what model and repetitions the guarantee refers to, rather than treating a confidence percentage as a universal measure of truth.
Invert a family of level tests
Suppose for each candidate we have a measurable nonrandomized test that rejects its point null with probability at most when that value is true. Define the confidence set as all candidates not rejected. The event that the set misses the true parameter is exactly the event that the test indexed by the true parameter rejects. Its probability is at most , proving coverage. No correction for testing every candidate is needed for this specific coverage statement: only the test indexed by the true value controls the miss event.
Conversely, rejecting a candidate exactly when it lies outside a valid confidence set produces a level test. For a target function with nuisance parameters, the candidate-null test must control rejection for all parameters sharing that target value. Randomized tests require explicitly incorporating the auxiliary random variable if an exact inversion is intended; simply retaining partially rejected values need not reproduce the same exact size. Set measurability is also assumed so that the coverage events have defined probabilities.
Exact calibration and approximate convenience
For iid normal observations with known variance, the standardized sample mean has an exact standard-normal distribution. Inverting its two-sided test yields an exact-coverage interval using the corresponding normal quantile. If the normal sampling law is replaced by a general finite-variance iid law, a central limit theorem may justify an asymptotic interval, but not exact finite-sample coverage. Replacing a known standard deviation with an estimate also changes the argument; the exact Student interval needs the iid normal model and its independent mean-variance structure.
For binomial data, exact tail inversion generally gives conservative coverage because count probabilities are discrete. A one-sided upper bound after observing zero successes solves , with endpoint conventions for other observations. It stays positive even though the observed proportion is zero. By contrast, the naive Wald interval using the estimated variance can collapse to a point at an endpoint and badly undercover. Confidence construction is therefore a calibration problem, not merely attaching two standard errors to every estimate.
Work it through
Invert an exact normal test
Sixteen iid observations have sample mean 10. Construct the two-sided 95% confidence interval for the unknown mean, using .
The standard deviation of the sample mean is . Under the candidate mean , the exact test retains that value when .
Rearrange the retained-value inequality to . This algebra reverses no sign because the standard error is strictly positive.
The margin is approximately 0.979982, so the interval is approximately [9.020018, 10.979982]. Its exact symbolic version using q has coverage 0.95 for every real mean under the known-variance normal model.
The confidence procedure has exact 95% coverage in the declared model; the rounded endpoints approximate the exact quantile-based endpoints.
The living notebook
Explore the model
Interactive lab · sampling
Why an endpoint estimate still has uncertainty
Reset and set both . Predict zero-success probability . Reset and set both ; predict . Compare the exact endpoint bars. The 95% one-sided upper bound for an observed zero lies between these probabilities. The lab displays sampling laws, not data-selected confidence intervals or posterior probabilities.
- Mean sample proportion
- 0.5
- Sample-mean variance
- 0.0125
- Uniform CDF error bound
- ≤ 0.1062
Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forAn observed zero success count is compatible with positive probabilities; exact inversion quantifies that compatibility.
Pause & reason
Check your understanding
Your turn
Try it yourself
Four iid Bernoulli trials produce zero successes. Use exact lower-tail test inversion to find a one-sided 95% upper confidence bound for , solving . Compare it with the naive zero-width plug-in Wald interval.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Take a fourth root before subtracting from one. A one-sided bound uses 0.05 here, not 0.025.
Compare with the solution
The upper bound is , giving interval for this observation. The exact tail-inversion procedure, with its other count-dependent endpoints, has coverage at least 95%. The plug-in variance at zero successes is zero, so a naive Wald interval collapses to ; it ignores substantial sampling uncertainty and has no comparable finite-sample guarantee.
Keep the idea
Take it with you
- Coverage describes a random procedure across repeated experiments.
- Retaining nonrejected values converts calibrated tests into confidence sets.
- Exact discrete intervals may be conservative; normal approximations need justification.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.