Confounding, nonstationarity and forecast validation
Evaluate forecasts at declared information boundaries, separate predictive association from causation and score both point accuracy and uncertainty.
On this page
The question for today
What you’ll understand
- Design chronological validation with all preprocessing and tuning restricted to available history.
- Explain how common trends and regime changes undermine naive predictive interpretations.
- Calculate point-forecast losses and an interval score without reusing final test information.
A forecast is a statement made from information available at a particular time. Validation must reproduce that information boundary, including the less visible decisions about scaling, missing values, covariates and parameter selection. Temporal dependence also means a large table of forecast errors is not automatically a collection of independent replicates. These issues become sharper when trends change or a model uses correlated series. A good evaluation records what was knowable, what was predicted and how the resulting uncertainty was assessed.
The forecast origin defines the available information
Let tau be the origin and h the horizon. The forecast for y at tau plus h must be a function of information available by tau. Training outcomes, transformations, estimated means, feature selection and hyperparameter decisions all belong inside that boundary. A centered moving average evaluated near the origin can use future observations. Scaling on the complete dataset can also leak later distributional information, even when the prediction equation itself only uses lagged features.
Future calendar variables may be known in advance, while future weather or prices generally require their own forecasts. Evaluating a regression with subsequently realized covariates measures an ex-post scenario rather than the ex-ante forecast that could actually have been issued. State smoothing within an already available training history is legitimate. Smoothing an origin's feature using observations after that origin is not. Availability timestamps, rather than column names, determine whether the evaluation reproduces the intended task.
Chronological evaluation must include the fitting policy
Rolling-origin validation repeatedly trains on the past and evaluates a later target. An expanding window retains all available history; a fixed-length rolling window discards older observations. Either can be reasonable, but they define different procedures under regime changes. Choose the window, refitting frequency and tuning policy using a chronological validation stage, then preserve a final test period for evaluating the selected procedure. Repeatedly changing a model after inspecting that test turns the test into additional training information.
Nonstationarity means old errors may poorly represent the next regime. Common trends can create apparent predictive association, while an omitted variable can drive both series; forecast accuracy does not identify a causal intervention. Even with a stable model, losses from overlapping horizons share outcomes or shocks and are generally dependent. Thus an iid standard-error formula based only on the number of error rows can be misleading. Any confidence assessment needs assumptions and methods suitable for its temporal dependence and evaluation design.
Score the target and uncertainty that matter
Squared error targets the conditional mean when the relevant second moment is finite; absolute error targets a conditional median under a finite first moment. Compare methods on the same origins, horizons and outcome scale, and report a simple benchmark. Pooling different horizons without stating the weighting can hide poor long-range performance. Percentage losses have additional difficulties near zero, so a familiar metric is not automatically appropriate for every outcome.
Prediction intervals need more than nominal coverage. An extremely wide interval can cover nearly everything while providing little useful information. Evaluate coverage together with width or a proper interval score, and state which sources of uncertainty the interval includes. A conditional known-parameter model interval can miss parameter uncertainty or structural change. No retrospective validation guarantees future performance under arbitrary distribution shifts, but a documented chronological design makes its evidence and limitations inspectable.
Work it through
Reproduce three one-step origins
Observe y-one through y-six as (10,12,11,15,14,18). Evaluate the naive forecast that repeats the latest available observation, using origins three, four and five and a one-step horizon.
At origin three the latest observation is eleven. Forecast y-four as eleven, then compare with fifteen to obtain error four.
At origin four forecast y-five as fifteen, obtaining error minus one. At origin five forecast y-six as fourteen, obtaining error four.
The squared errors are sixteen, one and sixteen. Their mean is eleven, and the root mean squared error is the square root of eleven. Each prediction uses only its own origin's history.
The one-step RMSE is sqrt(11). Using y-six to tune a scaler or window before these predictions would violate their information boundary even if their displayed formulas used only lagged values.
The living notebook
Explore the model
Interactive lab · sampling
An iid uncertainty formula has an explicit assumption
Pause and reset, then set both controls to p = 0.5 and n = 20. Predict the variance of the Bernoulli sample mean is 0.25/20=0.0125. For a fresh comparison, pause and reset, then set p = 0.5 and n = 100; the variance is 0.0025, five times smaller. Compare the exact binomial distributions. This instrument assumes independent Bernoulli trials and playback highlights outcomes rather than drawing samples. Overlapping forecast losses are not such trials, so this variance formula cannot simply be transferred to their average.
- 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 forA larger evaluation count gives a familiar precision gain only under the dependence assumptions behind that calculation.
Pause & reason
Check your understanding
Your turn
Try it yourself
On two validation targets, model A has errors (4,−1) and B has errors (4,2). Select by MSE. The selected model predicts fourteen on a later untouched test target of eighteen. Report that squared loss, and score its central 80-percent interval [12,16] for the same target.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Make the selection using only the two validation errors. In the interval score use alpha=0.2 and the distance above the upper endpoint.
Compare with the solution
Validation MSE is 17/2=8.5 for A and 20/2=10 for B, so select A before looking at the test target. Its test squared error is (18−14)²=16. The interval has width four and misses above by two; its score is 4+(2/0.2)·2=24. This one test loss does not establish a stable expected error, and revising the model because of this target would consume it as tuning information rather than preserve it as an untouched test.
Keep the idea
Take it with you
- Every fitting and preprocessing decision must respect each forecast origin's information set.
- Chronological validation evaluates a declared training policy and does not establish causation.
- Use compatible point and uncertainty scores while accounting for dependent errors and distribution changes.
Read further
Original sources and deeper explanations to follow at your own pace.
- Rob J Hyndman and George Athanasopoulos — Forecasting: Principles and Practice, Time Series Cross-Validation
- Rob J Hyndman and George Athanasopoulos — Forecasting: Principles and Practice, Evaluating Distributional Forecast Accuracy
- Rob J Hyndman and George Athanasopoulos — Forecasting: Principles and Practice, Ex-Ante Versus Ex-Post Forecasts
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.