core29 min studyLesson 248 in Mathematics

Confidence sets and test inversion

Construct confidence procedures by retaining nonrejected parameter values and interpret coverage as a repeated-experiment guarantee.

On this page

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 C(X)C(X) for θ\theta has coverage at least 1−α1-\alpha when Pθ{θ∈C(X)}≥1−αP_\theta\{\theta\in C(X)\}\ge1-\alpha 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.

inf⁡θ∈ΘPθ{θ∈C(X)}≥1−α\inf_{\theta\in\Theta}P_\theta\{\theta\in C(X)\}\ge1-\alpha
Finite-sample coverage is a uniform lower bound over candidate true parameter values for the stated experiment.↔ Scroll wide equations horizontally.

Invert a family of level tests

Suppose for each candidate θ0\theta_0 we have a measurable nonrandomized test ϕθ0(X)\phi_{\theta_0}(X) that rejects its point null with probability at most α\alpha 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 α\alpha, 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.

C(X)={θ0:ϕθ0(X)=0},Pθ{θ∉C(X)}=Pθ{ϕθ(X)=1}≤αC(X)=\{\theta_0:\phi_{\theta_0}(X)=0\},\qquad P_\theta\{\theta\notin C(X)\}=P_\theta\{\phi_\theta(X)=1\}\le\alpha
This exact event identity proves test-inversion coverage for a measurable family of nonrandomized level-alpha tests.↔ Scroll wide equations horizontally.

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 (1−pU)n=α(1-p_U)^n=\alpha, 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.

Invert an exact normal test

Sixteen iid N(μ,4)N(\mu,4) observations have sample mean 10. Construct the two-sided 95% confidence interval for the unknown mean, using q=Φ−1(0.975)≈1.959964q=\Phi^{-1}(0.975)\approx1.959964.

  1. The standard deviation of the sample mean is 2/16=0.52/\sqrt{16}=0.5. Under the candidate mean μ0\mu_0, the exact test retains that value when ∣(10−μ0)/0.5∣≤q|(10-\mu_0)/0.5|\le q.

  2. Rearrange the retained-value inequality to 10−0.5q≤μ0≤10+0.5q10-0.5q\le\mu_0\le10+0.5q. This algebra reverses no sign because the standard error is strictly positive.

  3. 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 result

The confidence procedure has exact 95% coverage in the declared model; the rounded endpoints approximate the exact quantile-based endpoints.

Explore the model

Interactive lab

Interactive lab · sampling

Why an endpoint estimate still has uncertainty

Reset and set both p=0.5,n=4p=0.5,n=4. Predict zero-success probability 1/16=0.06251/16=0.0625. Reset and set both p=0.53,n=4p=0.53,n=4; predict (0.47)4≈0.04880(0.47)^4\approx0.04880. 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.

Why an endpoint estimate still has uncertaintyExact 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). Current readings: Mean sample proportion: 0.5; Sample-mean variance: 0.0125; Uniform CDF error bound: ≤ 0.1062. All parameters are adjustable with the labeled controls below.Exact distribution of the mean of 20 independent Bernoulli variables with success probability 0.5; playback highlights outcome 0.00.250.50.75100.0580.1150.1730.23Sample mean · k / nProbability massNormal bin masses are an approximationk = 0 · exact probability = 9.54e-7
Exact binomial massNormal interval massHighlighted outcome / mean
Mean sample proportion
0.5
Sample-mean variance
0.0125
Uniform CDF error bound
≤ 0.1062
t = 0 s

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.

Check your understanding

What does a valid frequentist 95% confidence procedure guarantee?

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 pp, solving (1−pU)4=0.05(1-p_U)^4=0.05. 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 pU=1−0.051/4≈0.527129p_U=1-0.05^{1/4}\approx0.527129, giving interval [0,0.527129][0,0.527129] 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 [0,0][0,0]; it ignores substantial sampling uncertainty and has no comparable finite-sample guarantee.

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.