← 7. Time series
Time series validation
Try this analysis →

Time Series Backtesting and Rolling-Origin Validation

The question is not whether a model fit the past well, but whether it could have predicted using only what was known at the time.

Rolling originMAE·RMSE·MASEPrediction interval coverageData leakage

Final holdoutFold 1Train wk 1–120121~124Fold 2Train wk 1–128129~132Fold 3Train wk 1–136137~140Fold 4Train wk 1–144145~148wk 1wk 53wk 105wk 156TrainTest 4 wksHoldout wk 153–156
SECTION 1

Real-world example: weekly electricity use at a cold-storage warehouse

A cold-storage logistics center wants to forecast its electricity demand for the next 4 weeks to plan its power purchases.

The operations team has weekly electricity use for the last 156 weeks and believes that seasonal demand and equipment operating patterns may affect the forecast.

ItemDetails
Subject of analysisOne cold-storage logistics center
Observation period156 consecutive weeks
Outcome variableWeekly electricity use (kWh)
Forecast horizonNext 4 weeks
Candidate modelsSeasonal naive, ETS, SARIMA
Development periodWeeks 1–152
Final holdoutWeeks 153–156
7,5008,0008,500Holdout wk 153–156Development wk 1–152wk 1wk 53wk 105wk 156kWh
Weekly electricity use

Here, seasonal naive (Seasonal Naive) is a benchmark model that forecasts the value at the same position in the previous season as is. If weekly data are assumed to have annual seasonality, using the value from 52 weeks earlier is one example. However, the actual seasonal period should be chosen according to how the data are generated.

The research question is "Using only the data available at the actual time of forecasting, which model forecasts electricity use for the next 4 weeks most reliably?".

SECTION 2

How do you split the training, validation and final test periods?

If you use all 156 weeks from the start to choose a model, it is hard to check final performance independently.

So the last 4 weeks, weeks 153–156, are set aside as the final holdout, and the candidate models and settings are decided using weeks 1–152 only.

Development period wk 1–152Holdout wk 153–156wk 1wk 53wk 105Exploration · tuning · backtestingOne final evaluation
Splitting the periods

After running backtests several times within the development period, choose the most suitable model and retrain it on all of weeks 1–152. Then forecast weeks 153–156 for the first time and calculate the final score. If you change the model or settings again after seeing this final result, the holdout is no longer independent evaluation data.

PeriodPurpose
Weeks 1–152Model exploration · tuning · backtesting
Weeks 153–156Final evaluation, used only once

What matters is that the final holdout is not simply data set aside at the end, but data you have committed not to use for model selection.

SECTION 3

How does rolling-origin backtesting work?

In rolling-origin backtesting, the forecast origin is moved forward in time, and each time the model is retrained and a future period is forecast.

For example, the first validation could train through week 120 and forecast weeks 121–124, and the second could train through week 128 and forecast weeks 129–132.

Fold 1Train wk 1–120121~124Fold 2Train wk 1–128129~132Fold 3Train wk 1–136137~140Fold 4Train wk 1–144145~148149~152wk 1wk 40wk 80wk 120wk 152TrainTest 4 wksUsed only for final retraining
Four rolling-origin folds
FoldTraining periodTest periodForecast horizon
1Weeks 1–120Weeks 121–1244 weeks
2Weeks 1–128Weeks 129–1324 weeks
3Weeks 1–136Weeks 137–1404 weeks
4Weeks 1–144Weeks 145–1484 weeks

Every fold forecasts the 4 weeks after its training data. Weeks 149–152 remain in the development period, so they can be used when retraining the final model, and the final holdout of weeks 153–156 is not included in backtesting.

Having unused weeks between folds is not necessarily wrong. How often to move the forecast origin is decided by considering computational cost, the forecasting cycle and the length of the data. To evaluate forecast performance in finer detail, you can also move the origin every week.

SECTION 4

How do expanding and fixed training windows differ?

Ways of moving the training period include the expanding window (Expanding Window) and the fixed-length window (Sliding or Rolling Window).

Expandingwindowwk 1wk 1Weeks 1–120 → 1–128Fixed windowwk 17wk 25Weeks 17–120 → 25–128Test 4 wks
Expanding and fixed training windows

An expanding window lengthens the training period each time new data arrive, as in weeks 1–120, then 1–128. If old information remains useful, it has the advantage of using many observations.

A fixed window, by contrast, moves forward while keeping a constant length, such as the most recent 104 weeks. For example, if the first training period is weeks 17–120, the next can use weeks 25–128. It can be useful when operations have changed a lot recently and old data no longer describe the current situation well.

MethodExampleCharacteristics
Expanding windowWeeks 1–120 → 1–128Past data accumulate
Fixed windowWeeks 17–120 → 25–128Focuses on a fixed recent period

Neither method is always better. The validation scheme should match how the real forecasting system is retrained each time.

SECTION 5

How do MAE, RMSE and MAPE differ?

Forecast performance is evaluated using the forecast error (Forecast Error), the difference between actual and forecast values.

Among the most widely used metrics are mean absolute error (MAE), root mean squared error (RMSE) and mean absolute percentage error (MAPE). MAE is the average of the absolute values of the errors.

MAE = (1/n) Σ |yt − ŷt|

RMSE = √( (1/n) Σ (yt − ŷt)2 )

0-60wk 1+140wk 2-35wk 3+210wk 4-95wk 5+55wk 6-180wk 7+70wk 8Error kWhMAE105.6 kWhRMSE121.4 kWhMAPE1.29%
Comparing MAE, RMSE and MAPE

RMSE squares the errors, averages them and takes the square root. Because it penalizes large errors relatively more, it is worth consulting when you especially want to weigh situations where a large power shortfall occurs.

MAPE expresses the error as a percentage of the actual value. But it is undefined when the actual value is 0 and can become excessively large when the actual value is close to 0. For this reason it is not an appropriate metric for every time series.

The cold-storage center's electricity use is measured in kWh, so MAE and RMSE are easy to interpret. When comparing several centers of different sizes, you can also consider a scaled metric such as MASE.

SECTION 6

When do you use MASE?

Mean absolute scaled error (Mean Absolute Scaled Error, MASE) is the model's MAE divided by the error of a naive benchmark forecast calculated on the training data.

It is useful for comparing forecast performance across time series of different scales. For a series with seasonal period m, the seasonal MASE is usually calculated relative to lag-m differences in the training data.

MASE = [ (1/H) Σ |yh − ŷh| ] ÷ [ (1/(T−m)) Σ |yt − yt−m| ]

Numerator92 kWhTest-period MAEDenominator151 kWhTraining-period 52-wk naive÷=MASE0.61
Structure of MASE

Here, the denominator must be calculated only on the training period of that fold, not on the test period. Calculating the denominator from future test values means using future information in the validation step.

Generally, a MASE below 1 means the forecast errors were smaller than the training-period mean error of the naive benchmark used in the denominator. However, this is not always the same comparison as the score obtained by actually running that benchmark model on the test period, so state which benchmark was used.

SECTION 7

How do you compare actual backtesting results?

Suppose three models were evaluated on four folds.

The results below are the per-fold 4-week-ahead forecast MAE (kWh).

FoldSeasonal naiveETSSARIMA
111510088
212510895
3130115100
41109785
Mean MAE12010592
80100120140Fold 1Fold 2Fold 3Fold 4MAE kWhSeasonal naive120 kWhMean MAEETS105 kWhMean MAESARIMA92 kWhMean MAE
MAE by fold

Because the test periods of the four folds are all 4 weeks long, the arithmetic mean of the fold MAEs equals the MAE over all 16 test observations. SARIMA had the lowest mean MAE at 92 kWh, followed by ETS at 105 kWh and seasonal naive at 120 kWh.

In this example, SARIMA had the smallest error in every fold. But with only four folds, there is no guarantee that the score differences will hold in the future. In particular, you should also check whether errors increase in certain seasons or during equipment maintenance periods.

SECTION 8

Should you also check performance by forecast horizon?

For a model that forecasts 4 weeks at once, the accuracy for the first week and the fourth week may differ.

Uncertainty generally tends to increase as the forecast horizon lengthens, but the actual pattern of errors depends on the model and the data. So in addition to the overall mean MAE, it is good to check errors by forecast lag.

4080120781 wk ahead882 wks ahead963 wks ahead1064 wks aheadMAE kWhMean 92
Error by forecast horizon

For example, you can collect only the first forecast week of each fold and calculate its MAE, then do the same for the second, third and fourth weeks. This lets the operations team conclude, for example, that "next week's demand forecast" is accurate enough but "the demand forecast 4 weeks out" needs a larger buffer.

Also, if forecasts are updated weekly in real operations, backtesting should mimic forecasts being updated every week. In validation, do not confuse forecasting 4 weeks at once with adding the actual value each week and forecasting again.

SECTION 9

How do you evaluate prediction intervals?

Presenting a single forecast value makes it hard to convey the uncertainty in future demand adequately.

A prediction interval (Prediction Interval) provides a range in which a future observation is expected to fall, reflecting a specified level of uncertainty. For example, if next week's electricity forecast is 8,200 kWh and the 90% prediction interval is 7,800–8,650 kWh, the model is presenting that range of uncertainty under certain assumptions. This does not mean the actual use will definitely fall within that interval.

7,8008,2008,650Point forecast 8,200Upper 8,650Lower 7,80090% prediction interval · width 850 kWh
Prediction interval coverage and width

In backtesting you can look at prediction interval coverage (Coverage) and interval width (Width) together. For a 90% prediction interval, check whether the actual values fall inside it about 90% of the time over a sufficiently large number of future observations. But an interval that is too wide may be of little help for actual decisions, so width matters too.

Also, when the sample is small, such as 16 validation observations, the empirical coverage varies a lot, so do not draw firm conclusions about the accuracy of prediction intervals from small differences. If needed, you can also evaluate the interval score (Interval Score) or quantile loss (Pinball Loss).

SECTION 10

How does data leakage happen in time series validation?

Even if the data are split in time order, leakage can occur in the preprocessing and feature creation steps.

For example, if you standardize using the mean and standard deviation of all 156 weeks and then run backtesting, information from the future test periods is reflected in the training step.

Imputation of missing values, calculation of outlier thresholds, feature selection and model settings must also be decided only within each fold's training data. Decomposing seasonality using the whole series and then using trend values at future time points as explanatory variables can also be leakage.

The same applies to exogenous variables. If the actual future outdoor temperature could not have been known at the time of forecasting, you must not feed the future observed temperature into the backtest as is. Instead, you need to use the weather forecast that would have been available at the time, or forecast the exogenous variable itself as part of the procedure.

On the other hand, calendar information that is already fixed, such as holidays or days of the week, can be known for future time points and can therefore be used. The key criterion is not "does the value belong to a future time point?" but whether it could actually have been known when the forecast was generated.

SECTION 11

How do you interpret the final holdout score?

If SARIMA was chosen in backtesting, retrain the model on all of weeks 1–152 and then, for the first time, forecast the unused weeks 153–156.

Even then, you must not change the model orders or preprocessing settings to fit the final holdout results.

ModelFinal holdout MAE (kWh)
Seasonal naive126
ETS110
SARIMA98
90100110120130Seasonal naive120126ETS105110SARIMA9298Backtest meanFinal holdoutMAE (kWh)
Final holdout results

SARIMA also had the smallest MAE in the final evaluation, but at 98 kWh it was higher than its backtest mean of 92 kWh. Such a difference can arise from the demand pattern of the test period or from random variation.

The final holdout is only 4 weeks, so this single value cannot establish long-term operating performance. After deployment, it is good to monitor forecast errors, bias, prediction interval coverage and so on periodically to check whether performance degrades.

SECTION 12

How do you report backtesting results?

When reporting time series validation results, clearly present the overall observation period and frequency, the forecast horizon, the development and final test periods, the number of validation folds, the training window scheme, the candidate models, the error metrics and the final holdout score.

If exogenous variables were used, also explain how their future values were obtained at the time of forecasting.

Example results report

Time series data covering 156 weeks were analyzed to forecast the weekly electricity use of a cold-storage logistics center. The last 4 weeks (weeks 153–156) were reserved as the final test period, and rolling-origin backtesting with an expanding training window was performed on the remaining data. Backtesting consisted of 4 folds, and in each fold the electricity use for the following 4 weeks was forecast.

Comparing seasonal naive, ETS and SARIMA, the mean MAEs were 120 kWh, 105 kWh and 92 kWh, respectively, with SARIMA showing the smallest error. Accordingly, SARIMA was retrained on the entire development period and used to forecast the final holdout, giving an MAE of 98 kWh; over the same period, seasonal naive and ETS recorded 126 kWh and 110 kWh, respectively. These results suggest that SARIMA showed relatively better forecast performance in the validation periods of this case. However, because the final test period is short, additional operational monitoring is needed to confirm that the performance persists.

✓Wrap-up

Forecast performance should be checked with validation that mimics the future

What matters in time series forecasting is not how well a model fits past data, but how accurately it forecasts the future using only the information available at the time of forecasting.

To do this, it is useful to separate training and testing in time order and to run rolling backtests from several past time points.

You should also review not only scores such as MAE or RMSE but also errors by forecast horizon, prediction interval coverage, model stability and real operating conditions together. A final holdout not used for model selection helps confirm performance independently, but results from a short period alone cannot guarantee lasting performance.

KEY TAKEAWAY

The heart of time series backtesting is not just hiding future data until later, but faithfully reproducing the information that was actually available, and the decision process, at each past forecast point.