Note 16: Time Series Cross-Validation & Horizon-Specific Accuracy
Module 3: ARIMA & SARIMA Models
Learning Objectives
After completing this note, you will be able to:
Explain why standard random \(k\)-fold cross-validation leaks future information and underestimates forecast error in time series.
Contrast expanding-window (stretch_tsibble) and sliding-window (slide_tsibble) rolling-origin cross-validation designs.
Compute and visualize horizon-specific point (RMSE) and distributional (CRPS) error curves across \(h = 1, \dots, H\).
Diagnose how relative model rankings evolve across short, seasonal, and multi-year forecast horizons.
1. Why Random \(k\)-Fold Cross-Validation Fails
In cross-sectional regression with independent observations, randomly shuffling rows into \(k\) folds produces unbiased estimates of out-of-sample error. In time series, observations are temporally ordered and autocorrelated, so random \(k\)-fold splitting creates severe temporal data leakage:
Predicting \(y_t\) using models trained on \(y_{t+1}, y_{t+2}, \dots\) turns a forecasting task into interpolation, yielding artificially tiny errors that collapse in real-time deployment.
A single train/test split avoids leakage, yet evaluates each horizon \(h\) only once, making model rankings sensitive to whatever economic shock or weather anomaly happened during that one holdout window.
Time series cross-validation (rolling-origin evaluation) resolves both flaws by moving the forecast origin \(T_i\) forward sequentially through time, fitting only on data up to \(T_i\), forecasting \(h = 1, \dots, H\) steps ahead, and averaging errors \(e_{T_i + h | T_i} = y_{T_i + h} - \hat{y}_{T_i + h | T_i}\) separately at each horizon \(h\):
Two rolling-origin schemes cover most practical settings:
Expanding window (stretch_tsibble(.init, .step)): The training set starts with .init observations and grows by .step observations at each fold. Prefer this when the underlying data-generating process is stable and more history reduces parameter estimation variance.
Sliding window (slide_tsibble(.size, .step)): The training set maintains a fixed length .size as the origin advances by .step, dropping the oldest observations. Prefer this when structural drift or evolving regimes make distant history unrepresentative.
2. Rolling-Origin Cross-Validation on Australian Cement Production
We evaluate four forecasting models on quarterly Australian cement production (aus_production$Cement, 218 quarters from 1956 Q1 to 2010 Q2):
Before calling stretch_tsibble(), we trim the final \(H = 8\) rows so every one of the 23 rolling origins has a complete 8-quarter future evaluation window. Using .init = 120 (30 years) and .step = 4 (advancing one full year per fold) balances statistical power with fast execution.
Cross-validated RMSE and CRPS across selected horizons (23 rolling origins).
h
RMSE_ARIMA
RMSE_Drift
RMSE_ETS
RMSE_SNAIVE
CRPS_ARIMA
CRPS_Drift
CRPS_ETS
CRPS_SNAIVE
1
95.2
236.9
78.9
130.3
56.4
156.7
46.7
75.9
2
125.0
127.5
120.1
173.1
74.8
74.5
67.1
104.4
4
188.6
173.6
173.9
175.1
112.8
102.7
102.1
107.0
8
301.0
261.7
258.6
263.9
192.9
155.4
161.2
171.9
3. Horizon-Specific Accuracy Curves
Averaging errors over all horizons hides how uncertainty and model rankings shift as \(h\) grows. Plotting both RMSE (point accuracy) and CRPS (distributional accuracy) against horizon \(h = 1, \dots, 8\) exposes the full forecast profile.
cv_acc |>pivot_longer(c(RMSE, CRPS), names_to ="Metric", values_to ="Score") |>mutate(Metric =factor(Metric, levels =c("RMSE", "CRPS"))) |>ggplot(aes(x = h, y = Score, color = .model)) +geom_line(linewidth =0.9) +geom_point(size =2) +facet_wrap(~ Metric, scales ="free_y") +scale_x_continuous(breaks =1:8) +labs(title ="Horizon-Specific Cross-Validation Accuracy: Australian Cement",subtitle ="23 expanding-window folds (.init = 120, .step = 4); lower is better",x =TeX(r"(Forecast horizon $h$ (quarters))"), y ="Score (tonnes)", color ="Model" )
Figure 1: Horizon-specific RMSE (left) and CRPS (right) across 23 expanding-window CV folds for Australian cement production (h = 1 to 8 quarters).
Short-horizon dominance (\(h = 1\)):ETS (RMSE = 78.9, CRPS = 46.7) and ARIMA (RMSE = 95.2, CRPS = 56.4) dramatically outperform SNAIVE (130.0) and Drift (237.0) by combining recent level dynamics with quarterly seasonality.
Seasonal phase effects in Drift: Because Drift ignores seasonality, its error oscillates strongly with the seasonal cycle, spiking at off-phase horizons (\(h = 1, 3, 5, 7\)) and dipping at exact seasonal multiples (\(h = 4, 8\)) where the origin and target fall in the same quarter of the year.
Long-horizon convergence (\(h = 6\) to \(8\)): As forecast uncertainty accumulates over two years, damped-trend ETS retains the lowest RMSE at \(h = 8\) (259), while undamped ARIMA (which integrates shocks twice via \(d = 1, D = 1\)) accumulates larger variance and drifts upward in both RMSE and CRPS.
4. Practical Guidelines for Fast, Honest Time Series CV
Keep four operational rules in mind when designing rolling-origin CV:
Prevent subtle leakage: Compute any data-driven transformations (such as Box-Cox \(\lambda\) estimation, outlier winsorization, or feature scaling) strictly inside each training fold, never on the full series prior to stretching.
Match .step to your evaluation budget: Setting .step = 1 produces maximally overlapping multi-step forecast errors and multiplies runtime; advancing by .step = m (one season) yields well-spaced origins across every seasonal phase in a fraction of the compute time.
Prefer fixed specifications or fast models in large grids: Running exhaustive stepwise ARIMA() inside 100 folds is slow and can mix model selection variance with parameter variance; evaluate a clear shortlist of candidate specifications directly.
Trim trailing incomplete folds: Dropping the last \(H\) rows before stretch_tsibble() guarantees every horizon \(h = 1, \dots, H\) is averaged over the exact same number of folds \(K\).
Practice Exercises
Exercise 1. Compare expanding-window (stretch_tsibble(.init = 100, .step = 8)) versus sliding-window (slide_tsibble(.size = 100, .step = 8)) cross-validation for an \(\text{AR}(3)\) model on us_change$Consumption across horizons \(h = 1, 2, 3, 4\). Plot or tabulate RMSE by horizon and interpret both horizon decay and the expanding-vs-sliding trade-off.
Expanding vs. sliding window RMSE for AR(3) on Consumption (12 folds).
h
Expanding
Sliding
1
0.300
0.296
2
0.394
0.372
3
0.426
0.481
4
0.447
0.436
RMSE climbs from ~0.30 at \(h = 1\) to ~0.44 at \(h = 4\) as autoregressive memory fades and forecasts revert toward the unconditional mean. Expanding and sliding windows perform almost identically overall (sliding edges ahead slightly at \(h = 1, 2, 4\), while expanding is steadier at \(h = 3\)), reflecting modest post-1980 macroeconomic moderation paired with the bias-variance trade-off of dropping older quarters.
Exercise 2. Suppose a colleague runs 5-fold random cross-validation on monthly electricity demand and reports an RMSE 40% lower than rolling-origin CV at \(h = 6\). Explain specifically why the random-CV estimate is invalid and when a sliding window might beat an expanding window in practice.
Solution
Random 5-fold CV lets the model train on months immediately before and after each held-out month (for example, predicting June using May and July of the same year), exploiting two-sided temporal autocorrelation that never exists in real-time forecasting. Consequently, random CV measures interpolation error rather than \(h = 6\) extrapolation error. A sliding window can outperform an expanding window when the series undergoes gradual structural change (such as changing economic volatility, evolving consumer habits, or shifts in seasonal amplitude) so that discarding outdated history reduces bias by more than it increases estimation variance.
Key Takeaways
Never use random \(k\)-fold cross-validation on time series; always preserve temporal order with rolling-origin evaluation.
Use stretch_tsibble() (expanding window) for stable processes where longer history improves precision, and slide_tsibble() (sliding window) when older regimes lose relevance.
Evaluate accuracy separately at each horizon \(h = 1, \dots, H\): model rankings and uncertainty behavior often diverge sharply between 1-step and multi-year horizons.
Trim the final \(H\) observations before creating folds so every horizon averages over the exact same set of complete origins.