Prediction intervals and coverage
Split conformal regression attaches an interval to a numerical prediction. Its target is marginal coverage: P(Y ∈ C(X)) ≥ 1 − α. Here Y is a future outcome, C(X) is the interval, and α is the chosen miscoverage level. With a separately fitted predictor and independent, identically distributed calibration and test examples, the construction below satisfies this bound without requiring a correct regression model. Exchangeability provides a more general foundation. [1]
Marginal coverage averages over calibration and test randomness. It does not give a separate guarantee at every input, or promise that every realized calibration sample achieves the target. Subgroup coverage can also differ substantially from the aggregate. [2]
Scope and limits. This lesson studies one fixed predictor, an absolute-residual score and a scalar target. The invented measurements below teach the calculation; they are not sampled evidence for a coverage guarantee. Classification, adaptive scores and methods for dependent observations are outside the worked example. The tables make the rank and interval membership visible, so a diagram is unnecessary.
The residual threshold
Fit the predictor using training data. Reserve n other labeled examples for calibration. Compute each score as sᵢ = |yᵢ − f(xᵢ)|, sort the scores, and select the one-based rank k = ceil((n + 1)(1 − α)). For k ≤ n, call that score q. Return [f(x) − q, f(x) + q]. The same q gives every interval width 2q. [1]
For this illustrative implementation, k = n + 1 returns an unbounded interval. That conservative boundary choice covers every finite outcome. It also makes an otherwise invalid list index explicit. We use rational arithmetic for α so the ceiling does not depend on floating-point rounding at an integer boundary.
Keep three quantities distinct when checking the example: n counts calibration observations, k selects a sorted position, and q has the target's units. The expression n + 1 changes the selected position; it does not mean inventing another measured residual. In our nine-observation example, the tenth position is handled by the explicit unbounded fallback.
A nine-observation worked example
Imagine a frozen predictor of a component's length in millimetres. To isolate interval arithmetic, assign all nine calibration predictions the value 100 mm. Invent observed lengths of 101, 98, 103, 96, 105, 94, 107, 92 and 109 mm. Their absolute residuals are exactly 1 through 9 mm. These values are deliberately orderly, rather than a realistic measurement sample.
| Observation | Prediction, mm | Observed, mm | Residual, mm |
|---|---|---|---|
| 1 | 100 | 101 | 1 |
| 2 | 100 | 98 | 2 |
| 3 | 100 | 103 | 3 |
| 4 | 100 | 96 | 4 |
| 5 | 100 | 105 | 5 |
| 6 | 100 | 94 | 6 |
| 7 | 100 | 107 | 7 |
| 8 | 100 | 92 | 8 |
| 9 | 100 | 109 | 9 |
Choose α = 0.20. Then k = ceil(10 × 0.80) = 8, so q = 8 mm. A new prediction of 120 mm receives [112, 128] mm, with total width 16 mm. A subsequent observation of 127 mm is covered; 129 mm is not. Neither outcome changes the threshold already calculated.
Eight of the nine calibration residuals are at most 8 mm, giving calibration inclusion 8/9, approximately 88.9%. This is an arithmetic property of the constructed list. It is not an estimate of future coverage from an independent test set, and it should not replace the requested 80% target in a report.
| α | Requested coverage | Rank k | q, mm |
|---|---|---|---|
| 0.20 | 80% | 8 | 8 |
| 0.10 | 90% | 9 | 9 |
| 0.05 | 95% | 10 | Unbounded fallback |
At 90%, the interval around 120 becomes [111, 129] mm. At 95%, our implementation returns the entire real line. Do not silently clamp rank ten to rank nine: that would produce the same finite answer as the 90% calculation while concealing the requested rank. The boundary branch is part of the lesson, rather than a numerical inconvenience to suppress.
Illustrative Python lab
This original, synthetic example is illustrative and has no execution report. It uses Python's standard library, supplied numbers and pure calculations; it makes no model, network, shell or file calls. The assertions express expected arithmetic, not recorded test results. Download the complete lab.py.
from fractions import Fraction
from math import ceil, inf, isfinite
def threshold(residuals, alpha):
if not isinstance(alpha, Fraction):
raise TypeError('Use Fraction for alpha')
if not 0 < alpha < 1:
raise ValueError('alpha must be between zero and one')
values = list(residuals)
if not values or any(not isfinite(v) or v < 0 for v in values):
raise ValueError('Provide finite nonnegative residuals')
values.sort()
rank = ceil((len(values) + 1) * (1 - alpha))
return inf if rank > len(values) else values[rank - 1]
def interval(prediction, radius):
return prediction - radius, prediction + radius
def demo():
predicted = [100] * 9
observed = [101, 98, 103, 96, 105, 94, 107, 92, 109]
residuals = [abs(y - p) for p, y in zip(predicted, observed)]
q = threshold(residuals, Fraction(1, 5))
bounds = interval(120, q)
assert q == 8
assert bounds == (112, 128)
assert bounds[0] <= 127 <= bounds[1]
assert not bounds[0] <= 129 <= bounds[1]
assert threshold(residuals, Fraction(1, 10)) == 9
assert threshold(residuals, Fraction(1, 20)) == inf
return {'radius_mm': q, 'interval_mm': bounds}
if __name__ == '__main__':
print(demo())
For an exercise, replace only the final observed length, 109, with 190. The largest residual becomes 90 mm, but the eighth residual stays 8 mm. Thus the 80% interval remains [112, 128], while the 90% interval becomes [30, 210]. Explain both results before running anything. This deliberately extreme edit shows which sorted position the threshold reads; it does not establish robustness to arbitrary contamination.
The helper validates the residual list, but it cannot validate how observations were collected or whether the predictor was kept separate from calibration. Its input is already a list of errors. Supplying training errors instead would still produce a number. A successful assertion therefore checks the arithmetic contract, not the statistical data-collection contract.
Reading an evaluation table
Evaluate coverage together with interval size, and examine relevant subgroups. A marginal guarantee does not imply conditional coverage at each input. Calibration-sample randomness also matters: repeating calibration can change the procedure's coverage. [2]
Consider a separate invented evaluation of 100 components. Suppose 80 belong to group A and 20 to group B. Let 72 A outcomes and 8 B outcomes fall inside their intervals. The aggregate is (72 + 8)/100 = 80%, but the group rates are 72/80 = 90% and 8/20 = 40%. The aggregate alone hides a 50-percentage-point difference. These are stipulated counts, not empirical findings about a real model.
For this exercise, write a report containing the counts as well as percentages, the interval widths, the chosen α and the calibration size. Describe what changed between the original and edited residual lists. Keep the two exercises separate: the 100-component group counts were invented independently and were not generated by the nine-point lab. Combining them into an apparent experiment would create evidence that does not exist.
Before applying the construction elsewhere, document which records fit the predictor, which supply residuals and which evaluate the final intervals. State why the sampling assumptions are plausible for the intended population. If that argument is missing, report descriptive interval inclusion without presenting the theorem as an established property of the deployment. This is a suggested reporting discipline, not a certification procedure.
Explanatory questions
Q1 · RankWhy is the selected residual eight rather than seven?
The calculation uses ceil((9 + 1) × 0.8) = 8. Seven is a different sorted position. The radius is the value stored at the eighth position, which happens to equal eight in this deliberately simple list.
Q2 · UnitsWhat changes when the new prediction moves from 120 to 150 mm?
With q fixed at 8 mm, the interval moves from [112, 128] to [142, 158]. Its width remains 16 mm. Only the centre changes in this construction.
Q3 · BoundaryWhy does the 95% request produce an unbounded interval?
The requested rank is ceil(10 × 0.95) = 10, beyond nine supplied residuals. The explicit fallback includes every finite outcome. It should be reported as uninformative, rather than replaced silently with the largest observed residual.
Q4 · CoverageDoes the invented 80% aggregate establish 80% coverage for group B?
No. B has only 8 covered outcomes among 20, or 40%. The arithmetic illustrates why aggregate inclusion and subgroup inclusion are different quantities. Marginal coverage alone supplies no per-input promise. [2]
Q5 · EvidenceWhat would passing the lab assertions establish?
It would establish the expected behavior on these supplied cases in that execution. It would not prove exchangeability, establish performance on real components, or show that any trained predictor meets a deployment requirement. The synthetic inputs exercise indexing and interval arithmetic.
Source-check disclosure
Evidence scope and methodology
The lesson's method was checked against Algorithm 1.1 and Theorem 1.2 in the versioned theoretical reference. Interpretation was checked against the tutorial's discussion of marginal coverage, conditional coverage and calibration variability. Both are public author-written sources and share authors; they do not constitute independent expert verification.
ResearchNode searches supplied public application-paper leads. A saved solar-forecasting abstract was read, but its results are not evidence for this lesson and are not reproduced here. The bibliography cites the opened full-text originals instead. The tutorial's HTML body displays a date inconsistent with its arXiv version history; the recorded date below follows the version history. The numerical examples and Python are original teaching constructions. Code assertions are not execution evidence.
References
References and source links
- Angelopoulos, A. N., Barber, R. F., and Bates, S. (2026), v5. Theoretical Foundations of Conformal Prediction. arXiv:2411.11824.
https://arxiv.org/html/2411.11824v5 - Angelopoulos, A. N., and Bates, S. (2022), v6. A Gentle Introduction to Conformal Prediction and Distribution-Free Uncertainty Quantification. arXiv:2107.07511.
https://arxiv.org/html/2107.07511v6