Machine Learning: Time-Series — ML vs Econometrics
Most comparisons of this kind are rigged by accident, and the interesting part of the exercise is refusing to rig them. A forecast origin is a draw: run the same models on a window ending a year earlier and the ranking can reorder completely, so a single holdout supports far less than it appears to. Features that look innocuous can be inert — hand a gradient-boosted tree a raw trend index and it contributes exactly nothing beyond the last training observation, because a tree emits a constant past its final split. And a recursive multi-step forecast compounds its own errors in a way a model with a trend state does not.
So each example here scores multiple origins, states what the classical models get for free that the machine-learning ones must be handed, and reports where the answer flips. The through-line is that the advantage is conditional, and the conditions are legible: how many series, how much data per series, whether exogenous information exists, and how much signal is there at all.
The first example sets the bar deliberately high — one clean, strongly seasonal series, exactly what SARIMA (seasonal ARIMA) and exponential smoothing were designed for. The later ones move to the regimes where that bar comes down.
The failure mode all of this is guarding against. It has a name that never gets used above: look-ahead bias, and its general form, leakage — letting a model see, at fit time, information that would not have existed at the moment the forecast was due. It is rarely as blatant as training on the test set. It arrives through standardising with a mean computed over the whole sample, through a feature built from a revised data vintage rather than the first release, through picking hyperparameters by looking at the holdout, or simply through the analyst having read the news for the period being forecast. Every design choice below — refitting at each step rather than once, choosing the origin before seeing results, scoring several origins — exists to close one of these doors. The reason to name it is that leakage does not announce itself: it shows up as a model that looks unusually good, which is exactly the outcome nobody investigates.
What “out of sample” has to mean when time is involved. Ordinary cross-validation shuffles rows, which for a time series means training on the future to predict the past. The replacement is a walk-forward or expanding-window evaluation: fit on everything up to time t, predict t+1, move forward, refit, repeat. The point at which the fitting stops is the forecast origin. Two further distinctions decide what a number means. A one-step forecast is handed the true lags at every step, so nothing compounds; a multi-step path feeds the model its own predictions, and errors accumulate. And a multi-step forecast can be built two ways — recursively, iterating the one-step model forward, or directly, fitting a separate model per horizon, which avoids the compounding at the cost of estimating more. These are not bookkeeping details. On the panel example the same exponential-smoothing model scores 0.478 as a one-step forecaster and 0.757 fitted once and extrapolated as a single 40-step path — a 58% swing from the protocol alone, wider than the gap between any two models on that page.
Stationarity, differencing, and why the baselines change shape. Most of these methods assume the series is stationary — that its mean, variance and autocorrelations do not drift with time. Real macro and price series are not, so they are transformed until they roughly are, usually by differencing: modelling the change from one period to the next instead of the level. That transformation quietly redefines the naive benchmark, which is the single most common way these tables get misread. A persistence forecast repeats the last observed value, with nothing estimated at all. On a series in levels that means “expect no change.” On an already-differenced series the last observed value is last period’s change, so persistence now asserts that the change repeats — a real prediction, and usually a worse one. Both appear in the macro table, and they are 0.7207 and 0.6291: the same word would have covered two different baselines nine hundredths apart. The seasonal analogue, seasonal-naive, repeats the value from one full season ago, and on strongly seasonal data it is a far harder benchmark than it sounds.
Local, global, and the two competitions everyone cites. Given many related series there are two strategies. A local approach fits a separate model to each series, which sees only its own history. A global approach trains one model across all of them pooled together, sharing parameters — also called cross-learning, on the argument that it borrows strength, learning patterns from every series to help each one. The evidence usually cited is a pair of forecasting competitions run by Spyros Makridakis. M4 (2018) ran 100,000 largely unrelated series and did not favour machine learning: several pure ML entries finished below a seasonal-naive benchmark and the winner was a hybrid. M5 (2020) ran roughly 42,840 Walmart sales series in one hierarchy and flipped it completely — all fifty top entries used machine learning. The panel example below tests which regime is responsible, and finds that on a panel of long series the gain comes from model flexibility rather than from pooling at all.
Reading the numbers. Accuracy here is RMSE, the root mean squared error, in the units of whatever is being forecast; the M-competitions instead use scale-free measures such as MASE (mean absolute scaled error, the error divided by the naive forecast’s), which matter when averaging across series measured in different units and matter less here, where each comparison is within one series or one standardised panel. A difference in RMSE is not automatically a finding, so the comparisons are tested: the Diebold–Mariano test takes the two models’ squared errors on the same dates, forms the difference series, and asks whether its mean is distinguishable from zero once autocorrelation is allowed for. It behaves like a t-statistic — beyond about ±1.96 the ordering is real, inside it the two models are tied however different the RMSEs look. For direction rather than magnitude the metric is AUC, the area under the receiver-operating-characteristic curve, which is the probability a randomly chosen up-day is scored above a randomly chosen down-day; 0.5 is a coin flip. And the recurring econometric benchmark on volatility is HAR, the heterogeneous autoregressive model — a regression on yesterday, last week and last month, three terms, which turns out to be remarkably hard to beat.
The cast. SARIMA (seasonal autoregressive integrated moving average) and ETS (exponential smoothing, in its error-trend-seasonal form) are the classical univariate workhorses. A VAR (vector autoregression) extends autoregression to several series that influence each other, and a BVAR (Bayesian VAR) is the same system with a shrinkage prior on its coefficients. On the machine-learning side sit gradient-boosted trees and an LSTM (long short-term memory), a recurrent network with gates designed to carry information across long gaps. Each is treated in depth elsewhere in the collection; here they are contestants.
The conditional answer, the protocol that nearly hid it, and the capstone
Every value is committed notebook output. A draws on all three forecasting examples, B on the panel example, C on the financial one.
A is the section’s whole argument in three bars, and the ordering is the finding. On one clean seasonal series the best machine-learning model is 18.5% worse than the best classical one — and that is the charitable reading, using the standardised Lasso rather than the gradient booster, which is worse still. Add five more series that influence each other and the gap closes to 1.2% in ML’s favour, which a Diebold–Mariano statistic of −0.52 says is no gap at all. Move to a panel of 48 related series and ML is 5.2% ahead at +3.32, which is real. Two of the three regimes therefore return “no difference” or “classical wins”, and the win, when it comes, is worth about five percent. What changes across the three is not the algorithms but the shape of the problem.
B is a warning about how easily A could have been fabricated. The six models on the panel example span 0.062 from best to worst — that entire range is the payoff to every modelling decision on the page. Take the classical baseline and change nothing except how it is scored, fitting it once and extrapolating a single 40-step path instead of refitting it as a genuine one-step forecaster, and it moves 0.279: four and a half times the whole model spread. It lands far to the right of everything, including the do-nothing baseline, and would have read as a broken method rather than a broken protocol. The general form of the point is that an evaluation design can dominate every result computed inside it, so it has to be settled before any comparison is run.
C is what the discipline of the first three examples is for. On the left, the same model ranks the training data perfectly — AUC 1.000 — and lands on 0.499 out of sample, which is a coin flip. Nothing was learned; noise was memorised. On the right, a subtler version of the same illusion: the strategy’s gross Sharpe ratio of 0.74 sits just above buy-and-hold’s 0.72 and reads as a small edge. It is not one. The model is long on 65% of days, so it collects the market’s drift by construction, and “always long” scores 0.72 without predicting anything. Costs then take it to 0.13. The order matters: the costs are what killed it, but there was no edge there to begin with, and a backtest reporting only the gross figure would have shown a working strategy.
How the four examples relate
One question asked four times, on deliberately harder terms each time. The first three vary the shape of the forecasting problem; the fourth varies how much signal exists at all.
The classical models’ home ground
One series, long history, strong seasonality. If ML cannot win here, why not?
1 · Univariate forecastingclassical wins — but a broken preprocessing step and a single lucky origin were doing part of the workTwo ways to make it harder
More series at once, or more series to learn from. They pull in opposite directions.
2 · Multivariate macrosix series, 222 coefficients — shrinkage rescues it and ML draws level without winning 3 · Global panel forecasting48 related series, one pooled model — ML wins, though not for the reason usually givenWhere the signal runs out
What happens when the honest answer is that nothing is predictable?
4 · Financial returnsthe capstone — two results that imitate skill, and how each one is taken apartExamples 2 and 3 are the pair worth reading against each other, because they isolate different things. The macro system is deep and narrow — a few hundred observations on six series — so the binding constraint is parameters, and shrinkage is what helps. The stock panel is wide and shallow in principle, which is the regime the M5 competition made famous, except that 260 weeks per series turns out to be enough history that pooling buys nothing and the gain comes from flexibility instead. Same word, “more data”; opposite remedies.
Univariate Forecasting — Classical vs ML vs Neural
SARIMA and Holt–Winters against a gradient booster, a Lasso autoregression and an LSTM, forecasting 24 months of US retail sales. At the obvious forecast origin the classical models win comfortably — but the notebook does not stop there, because one origin is a draw, not an evaluation. Refit at five rolling origins and the ranking reshuffles — a Lasso wins outright at two of five, and the seasonal-naive baseline that looks competitive at the headline window is the worst model on average. Averaged properly ETS and SARIMA still lead, but the gap is far narrower than one window suggests. Two mechanisms are isolated rather than asserted. The Lasso was broken: an unstandardized design let L1 zero nine of ten features, leaving a bare trend line — visible in the coefficients, invisible in the RMSE, and worth 0.085 → 0.032 once fixed. And the LSTM flatlines because a recursive forecast is a dynamical system that walks into an attracting fixed point.
View example →Multivariate Macro — VAR / BVAR vs Machine Learning
Six FRED macro series forecast jointly, where a VAR(6) carries 222 coefficients on a few hundred noisy months. Adding the benchmark the notebook lacked — a random walk in levels, not a repeat of last month’s change — sharpens the headline: the unrestricted VAR scores 0.6249 against 0.6291 for predicting nothing at all. Two hundred and twenty-two estimated coefficients buy a dead heat with doing nothing. Sixty one-step forecasts then allow Diebold–Mariano tests rather than eyeballing: the Lasso-VAR (−2.33), BVAR (−2.11) and booster (−2.00) beat OLS, but Ridge does not (−1.76), so “every shrinkage method wins” overstates it. And the section’s real claim survives — gradient boosting is statistically tied with the BVAR (−0.52) and Lasso-VAR (−0.23), competitive without winning. The LSTM finishes last, behind a random walk.
View example →Global Panel Forecasting — Pooling vs Flexibility
The regime the two previous examples predicted ML would win, and it does: one gradient booster across 48 volatility series scores 0.4189 against 0.4417 for per-stock fits. But the stated mechanism — borrowing strength across the panel — is not what produces it. Adding the missing control, one pooled linear AR, splits the gain: −0.001 from pooling, +0.024 from nonlinearity, with Diebold–Mariano at −0.24 and +4.02 respectively. The sweep then rescues the M5 claim as a conditional one: at 20 weeks per series pooling is worth +0.137 and flexibility nothing; at 240 weeks they swap. This panel’s 260 weeks put it on the wrong side of the crossover. Also corrects a mis-scored baseline — ETS was given a single 40-step path while everything else got one step, worth 0.757 → 0.478.
View example →Financial Returns — the Honesty Capstone
The case where the discipline of the previous three pays off: returns are close to unpredictable, and the skill is resisting the ways one fools oneself. The full ML roster forecasts direction at AUC 0.48–0.50 and none clears the “always predict up” baseline of 0.563. A deep model hits in-sample AUC 1.000 and out-of-sample 0.499 — memorised noise. Two further findings sharpen it. The strategy’s gross Sharpe ratio — return per unit of risk taken, where roughly 0.5 is what simply holding the market has paid — is 0.74 against buy-and-hold’s 0.72, and that is not an edge: the model is long 65% of days, so it inherits the drift, and a gross-only backtest would have read as a working strategy. And on volatility — the one target that is predictable — the booster’s +0.458 is beaten by a three-term HAR regression at +0.518.
View example →