Contents/ Part XXII · Time Series & Forecasting/ Chapter 133

Forecasting Models

Decomposition told you what a series is made of; forecasting predicts where it goes. This chapter fits the standard toolkit, baselines, moving averages, Holt-Winters smoothing, and ARIMA/SARIMA, holds out the last year of data, and lets the honest test decide which model wins.

⏱️ ~24 min read
🐍 Notebook included
📊 Chapter 133

A forecast is a claim about the future, and the future is the one thing you cannot peek at. So the entire discipline rests on one habit: split in time, fit on the past, and score on data the model has never seen. Get that right and the models themselves form a short ladder, from a naive baseline you must beat, up through exponential smoothing and ARIMA, each adding one more piece of structure.

📈
A forecasting model extrapolates a time series into the future. The core families are baselines (naive, seasonal-naive), exponential smoothing (SES, Holt, Holt-Winters), and ARIMA / SARIMA. They are judged on a held-out stretch of time, and a forecast can be static (one step ahead) or dynamic (many steps, feeding predictions forward).
🎯
Two rules that outrank every model

Never shuffle a time series. Train on the earlier part and test on the most recent part, so the evaluation mimics real forecasting. And always beat a baseline: if a fancy model cannot beat “same month last year”, it is not earning its complexity.

1

Backtesting, Baselines & the Horizon

Before any model, set up the test honestly and draw the line every model has to clear.

Split in time, then forecast: static hugs the data, dynamic is the honest test train (fit on the past) test (the held-out future) forecast starts here actual static dynamic static = 1-step-ahead, uses REAL past values (optimistic) dynamic = multi-step, feeds its OWN predictions (honest)

A baseline is the forecast a five-year-old could make. The naive method repeats the last value; the seasonal-naive method repeats the value from one season ago (same month last year). On our data the naive forecast scores a poor 13.6% MAPE while seasonal-naive, capturing the yearly wave for free, hits 4.1%, that 4.1% is the bar. Just as important is the horizon: a static (one-step-ahead) forecast quietly uses the real value at each step and looks great, while a dynamic (multi-step) forecast feeds its own predictions forward and its error grows the further out you look. Evaluate at the horizon you will actually forecast.

2

Moving Averages & Exponential Smoothing

The first real family builds a forecast from a fading average of the past, then adds back the structure a plain average throws away.

Weight the recent past more, then add trend and season weights fade into the past (rate α) now older recent observations count most the Holt-Winters family adds one piece at a time SES: level Holt: + trend Holt-Winters: + season level + trend + season, each with its own smoothing rate seasonal part is additive (fixed swing) or multiplicative (growing swing)

A moving average smooths the series but forecasts a flat line. Simple exponential smoothing (SES) improves on that by weighting recent points more, with weights that decay geometrically (one rate, alpha), yet it still has no trend or season and predicts a flat line too (13.6% MAPE here). Holt adds a trend term; Holt-Winters adds a seasonal term as well, and because this series' seasonal swing grows with its level, the multiplicative Holt-Winters wins outright at 2.8% MAPE. The lesson from the Components of a Time Series chapter returns: match additive vs multiplicative to the data.

3

ARIMA & SARIMA

The other great family does not smooth; it models the correlations directly, using exactly the stationarity and autocorrelation ideas from the last chapter.

Reading SARIMA(p, d, q)(P, D, Q)ₛ SARIMA(p, d, q)(P, D, Q) AR( p ) regress on recent VALUES I( d ) DIFFERENCE to make it stationary MA( q ) regress on recent ERRORS (P, D, Q)ₛ repeats all three ONE SEASON back, at lag s (here s = 12) d and D are simply the first and seasonal differences that made the series stationary earlier

ARIMA(p, d, q) stacks three ideas: AR(p) regresses on the p most recent values, I(d) differences the series d times to make it stationary, and MA(q) regresses on the q most recent forecast errors. SARIMA adds a seasonal copy (P, D, Q) at the season's lag s. Fitting SARIMA(1,1,1)(1,1,1,12) forecasts our holdout at 3.7% MAPE, also beating the baseline, and, being a full statistical model, it hands back a prediction interval that Holt-Winters does not. Which of the two wins is usually a coin toss, so fit both and let the holdout decide.

4

Real-World Example: Forecasting Airport Passengers

The companion notebook runs the whole ladder on a ten-year passenger series, holding out the final year and scoring every model with MAPE.

📂 Dataset · forecasting-models--airport_passengers.xlsx

Monthly passengers at a growing regional airport, 120 observations from January 2014 to December 2023, with a clear upward trend and strong multiplicative yearly seasonality (summer peak, winter trough). Columns: month and passengers. The last 12 months are the test set.

  • Baseline: seasonal-naive scores 4.1% MAPE, the bar to beat (plain naive is 13.6%).
  • Winner: Holt-Winters (multiplicative) at 2.8%, matching the growing seasonal swing.
  • Close behind: SARIMA(1,1,1)(1,1,1,12) at 3.7%, and it comes with a 95% prediction interval.
  • Horizon: the multi-step error grows from about 2% one month out to 3.4% a year out.
5

Forecasting in Machine Learning & AI

Classical models remain strong baselines, but modern forecasting reframes the problem as machine learning, and, more and more, as a job for large pre-trained models.

ApproachIdeaExamples
ClassicalModel the components after making the series stationaryHolt-Winters (ETS), ARIMA / SARIMA, this chapter
ML regressionTurn the past into columns (lags, rolling stats, calendar parts) and fit a tabular modelLag features + XGBoost / LightGBM
Additive MLA decomposable model robust to holidays, gaps, and changepointsProphet
Deep learningNetworks that learn temporal structure and forecast probabilisticallyDeepAR, N-BEATS, Temporal Fusion Transformer
Foundation modelsPre-trained on many series; forecast a new one zero-shotTimeGPT, Amazon Chronos, Google TimesFM
🔬 Research frontier

Two shifts define the frontier. First, global models, a single model trained across thousands of related series (all stores, all SKUs) instead of one model per series, which usually wins at scale. Second, time-series foundation models that forecast an unseen series with little or no fine-tuning. Yet the winners of forecasting competitions are still often simple statistical models or their ensembles; the ideas here, baselines, seasonality, and honest backtesting, remain the yardstick every new method is measured against.

🐍

Fit the whole ladder in Python

The companion notebook splits the passenger series in time, sets naive and seasonal-naive baselines, fits a moving average and simple exponential smoothing, then Holt-Winters and SARIMA, scores every model with MAPE on the held-out year, draws the SARIMA prediction interval, and contrasts a static one-step forecast with an honest dynamic multi-step one, all with statsmodels.

📓 View Notebook (code & outputs) ▶ Open in Colab ⬇ View / Download on GitHub

View opens the rendered notebook instantly. Open in Colab runs it live. To run locally, install numpy, pandas, matplotlib, statsmodels, and openpyxl.

🎓 Key Takeaways

  • Split in time, never shuffle: fit on the past, test on the most recent stretch, and score with a scale-free metric like MAPE.
  • Beat a baseline or stop: seasonal-naive (same period last year) is the bar; here it is 4.1% MAPE.
  • Exponential smoothing builds up: SES (level) → Holt (+trend) → Holt-Winters (+season); the multiplicative version won here at 2.8%.
  • ARIMA/SARIMA model the correlations: AR values + I differencing + MA errors, plus a seasonal copy, and it returns a prediction interval.
  • Static vs dynamic: one-step-ahead flatters the model; multi-step is the honest test and its error grows with the horizon.
6

Practice Challenges

Five exercises on the passenger series. Full solutions are in the companion solutions notebook.

1

Baselines

Compute the naive, seasonal-naive, and drift baselines and their MAPE. Which is the bar to beat, and why?

Hint: seasonal-naive repeats the value 12 months back.
2

The smoothing ladder

Fit SES, Holt, and Holt-Winters and compare. What does each added component buy you?

Hint: SimpleExpSmoothing, Holt, ExponentialSmoothing.
3

Choosing SARIMA orders

Fit two candidate orders, pick by AIC, and forecast 12 months with a 95% interval.

Hint: lower AIC is better; do not peek at the test set to choose.
4

Head to head

Compare Holt-Winters and SARIMA on the same holdout. Is there a universal winner?

Hint: fit both, tabulate MAPE, plot both forecasts.
5

The horizon matters

Show that multi-step forecast error grows the further ahead you predict.

Hint: plot absolute percent error by months-ahead.
📓

Solutions notebook

All five challenges worked in code, baselines, the smoothing ladder, choosing SARIMA orders by AIC, a Holt-Winters versus SARIMA head-to-head, and how error grows with the forecast horizon, each with a short explanation.

📓 View Solutions ▶ Open in Colab ⬇ GitHub
7

Quiz: Test Yourself

Eight questions on baselines, smoothing, ARIMA, and the forecast horizon. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved.

➡️
Up next

These models assume a fairly steady variance. When the volatility itself moves, as in financial returns, you need more. Volatility & Advanced Models covers ARCH/GARCH, the ACF/PACF toolkit for order selection, unit-root tests, and Granger causality.