Concepts

Time series forecasting

5 min readintermediateUpdated 28 Sept 2026
1 · In one line

Time series forecasting predicts future values of something measured over time, such as sales or electricity demand, from the patterns in its past.

1 · What it is

Time series forecasting predicts future values of something recorded over time. Planning depends on it: staffing a call centre next week, stocking a warehouse, or deciding whether to build a power plant. Past data usually mixes a few patterns. A trend is a long-term rise or fall. A seasonal pattern repeats on a fixed calendar period, such as every December. A cycle rises and falls without a fixed period, usually with the economy. Some series, like daily changes in a stock price, are mostly random fluctuations with little to predict.

Every forecast should be compared with simple baselines. The naive method repeats the last value; seasonal naive repeats the value from the same month last year; the mean method uses the average of all history. A new method that cannot beat these is not worth using. Exponential smoothing and ARIMA are the two most widely used classical approaches. Exponential smoothing takes a weighted average of past values, with recent ones counting more. ARIMA describes autocorrelation: how each value relates to earlier ones. Python’s statsmodels library implements both, and Google BigQuery can fit an ARIMA_PLUS model in SQL or use its built-in TimesFM model. Machine learning turns past values into lag features: scikit-learn’s example feeds recent bike rentals into a gradient boosting model to predict the next hour. DeepAR, a 2017 method, trains a recurrent network on many related series and outputs probabilistic forecasts; its paper reported about 15 per cent better accuracy on its datasets. Newer is not automatically better, though: a 2018 study of 1,045 monthly series found popular machine learning methods less accurate than eight traditional statistical ones at every horizon tested.

The testing rule is strict: judge a model only on data it never saw, and keep time in order. Hold out the latest stretch as a test set, ideally at least as long as the furthest forecast you need. Rolling-origin evaluation repeats this with the cut moved forward, and each training set holds only earlier values. A random shuffle breaks the rule by training on the future, which is a form of data leakage; in scikit-learn’s bike example, the shuffled score was too optimistic. Errors are summed up as MAE (the average size of the misses), RMSE (the square root of the average squared miss) or MAPE (the average percentage miss), which fails when an actual value is zero. A prediction interval adds a range that should contain the real value with a stated probability, often 80 or 95 per cent.

Forecasting assumes the way things are changing will carry on. Errors grow the further ahead you look. A financial or political crisis can make the future unlike the past, and some forecasts, such as exchange rates, change the very thing they predict.

2 · Why it exists

Plans need numbers about the future, and those numbers are easy to get wrong.

Plans need numbersStaffing a call centre, stocking a warehouse or building a power plant all depend on forecasts, from minutes to years ahead.
Easy to fool yourselfHow well a model fits the data it learned from says little about how large its real forecast errors will be.
One number hides doubtA single forecast value gives no way of telling how accurate it is likely to be.
3 · How it works

Follow one forecast from the history to its error score.

Cut the series in time, forecast the hidden months from earlier values only, then score the gap. All numbers are illustrative.
  1. 1 · splitCut the series at a point in time, so earlier values are training data and the latest stretch is the test set.
  2. 2 · forecastForecast the test period using only values from before the cut, for example the same month last year.
  3. 3 · compareTake the gap between each forecast and the actual value, and average the gaps, for example as MAE.
  4. 4 · rollMove the cut forward and repeat, so the score averages over many starting points.
  5. 5 · chooseKeep a new model only if it beats simple baselines such as naive and seasonal naive.

Train on the past, test on the future: no later value may shape an earlier forecast.

4 · Where it's used
WhoWhat they askWhat it works with
Call centre manager“How many agents do we need on Monday morning next week?”Past call volumes by hour and weekday
Electricity utility“What will demand be during next week's heatwave?”Past demand alongside temperatures and holidays
Retail planner“How much stock should we order for December?”Same-month sales from earlier years and the recent trend
Bike share operator“How many bikes will be rented in the next hour?”Rentals in recent hours and at the same hour yesterday
5 · What it solves, and what it doesn't
solves
  • Simple baselines show whether a complex model adds anything beyond copying the past.
  • A time-ordered test estimates how a model will do on data it has never seen.
  • Prediction intervals show how uncertain each forecast is.
  • Trend and seasonal patterns can be carried forward when they keep behaving the same way.
doesn't solve
  • It cannot find patterns in series that are mostly random, such as daily changes in a stock price.
  • It assumes the way things change will continue; a financial or political crisis can break that.
  • Errors grow as you forecast further ahead.
  • When a forecast changes people's behaviour, as with exchange rates, the past stops being a reliable guide.
6 · Go deeper

Sources used

This explainer is written in original language. The links below support its factual claims.

  1. paperForecasting: Principles and Practice (3rd ed), 1.1 What can be forecast?, Hyndman and Athanasopoulos (OTexts) · read 27 Sept 2026
  2. paperForecasting: Principles and Practice (3rd ed), 2.3 Time series patterns, Hyndman and Athanasopoulos (OTexts) · read 27 Sept 2026
  3. paperForecasting: Principles and Practice (3rd ed), 5.2 Some simple forecasting methods, Hyndman and Athanasopoulos (OTexts) · read 27 Sept 2026
  4. paperForecasting: Principles and Practice (3rd ed), 5.8 Evaluating point forecast accuracy, Hyndman and Athanasopoulos (OTexts) · read 27 Sept 2026
  5. paperForecasting: Principles and Practice (3rd ed), 5.10 Time series cross-validation, Hyndman and Athanasopoulos (OTexts) · read 27 Sept 2026
  6. paperForecasting: Principles and Practice (3rd ed), 5.5 Distributional forecasts and prediction intervals, Hyndman and Athanasopoulos (OTexts) · read 27 Sept 2026
  7. paperForecasting: Principles and Practice (3rd ed), chapter 8: Exponential smoothing, Hyndman and Athanasopoulos (OTexts) · read 27 Sept 2026
  8. paperForecasting: Principles and Practice (3rd ed), chapter 9: ARIMA models, Hyndman and Athanasopoulos (OTexts) · read 27 Sept 2026
  9. docsTimeSeriesSplit, scikit-learn · read 27 Sept 2026
  10. docsLagged features for time series forecasting, scikit-learn · read 27 Sept 2026
  11. paperDeepAR: Probabilistic Forecasting with Autoregressive Recurrent Networks, Salinas, Flunkert and Gasthaus (arXiv) · read 27 Sept 2026
  12. paperStatistical and Machine Learning forecasting methods: Concerns and ways forward, Makridakis, Spiliotis and Assimakopoulos (PLOS ONE) · read 27 Sept 2026
  13. docsstatsmodels.tsa.holtwinters.ExponentialSmoothing, statsmodels · read 27 Sept 2026
  14. docsstatsmodels.tsa.arima.model.ARIMA, statsmodels · read 27 Sept 2026
  15. docsThe CREATE MODEL statement for ARIMA_PLUS models, Google Cloud · read 27 Sept 2026