Rolling origin and prediction intervals
Quick answer
Rolling-origin evaluation repeatedly forecasts from earlier origins and compares to later observed targets. Prediction intervals describe uncertainty for future observations, not merely uncertainty about the conditional mean. Examples are static Python snippets tested locally on CPU; Statsmodels and scikit-learn are required for selected examples. ByteMind execution is unverified.
Empirical interval coverage
errors=[1,2,3,4];q=sorted(errors)[2];forecast=10actual=[6,7,13,14]print([forecast-q,forecast+q],sum(forecast-q<=a<=forecast+q for a in actual)/len(actual))Expected output (locally tested): [7, 13] 0.5. The interval was set from calibration; boundary points count as covered.
How it works
For daily one-step forecasts, fit on a training prefix and predict successive future days; if the protocol permits, each newly observed target becomes available for subsequent lag features. Expanding-window refits use all available history; sliding windows use a fixed recent span. Freeze refit policy, feature transformations, horizon and hyperparameter selection before testing. For delayed targets use availability timestamps and a gap or purge window where needed; for overlapping multi-step targets, errors are dependent and cannot be treated as independent replicates. A simple residual interval uses a held-out chronological calibration block: collect |y-yhat| from the selected fixed model, choose a documented quantile q and report [yhat-q,yhat+q]. A split conformal order statistic uses rank ceil((n+1)*(1-alpha)), with infinite bound if rank>n; its finite-sample marginal guarantee requires exchangeability (and independent calibration from fitting/selection). Time dependence or drift can violate that assumption, so this chapter uses empirical residual quantiles and reports actual coverage and width, not a guarantee. Report coverage as fraction of targets inside inclusive bounds, average width, and horizon-specific behavior. Fit/select/calibrate/test on separate chronological blocks. Do not tune interval width using final test coverage. Prediction intervals target individual future observations, while confidence intervals usually target parameters or a mean.
Chronological split with gap
from sklearn.model_selection import TimeSeriesSplitfor a,b in TimeSeriesSplit(n_splits=2,test_size=2,gap=1).split(range(7)): print(a.tolist(),b.tolist())Expected output (locally tested): [0, 1] [3, 4] [0, 1, 2, 3] [5, 6]. A gap separates the final training row from each evaluation block.
Common mistakes
Do not calibrate on training errors or select quantiles on the test block. Do not claim exchangeability for a dependent time series without evidence.
Practice and next steps
Using calibration errors [1,2,3,4], construct a nearest-rank 75% interval around forecast 10 and compute coverage for outcomes [6,7,13,14]. Discuss why observed coverage may differ from 75%.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Rolling origin and prediction intervals — knowledge check
Apply rolling origin and prediction intervals to small examples and debugging scenarios.
What is rolling-origin evaluation?
Where should residual interval calibration occur?
What does a prediction interval target?
What can invalidate standard conformal guarantees?
How is observed interval coverage computed?