Problem
A data scientist in Sber's corporate and investment business expenses team has to forecast a monthly amount. The series grows over time and drops sharply every January, so a plain trend line or a simple autoregression misses the yearly cycle. The business adds one constraint: the amount may grow by no more than the inflation index year over year.
Example from the article: a monthly sum series from January 2023 to mid-2025 with a January dip every year and a December peak in 2023.
Solution in brief
Decompose the series to see trend and seasonality, confirm non-stationarity with the augmented Dickey-Fuller (ADF) test, then fit a seasonal ARIMA (SARIMA) model with a 12-month period. Let auto_arima choose the orders and check the forecast against a held-out period by MAPE.
Questions this case answers
- How to forecast a monthly aggregate with a trend and a fixed yearly seasonal cycle when only its own history is available
- How to decide whether a series needs differencing before fitting a classical autoregressive model
- How to forecast a monthly business amount that has a trend and a yearly seasonal pattern?
- How to check whether a time series is stationary before choosing a forecasting model?
Tools and methods
- seasonal_decompose (statsmodels) — splits the series into trend, seasonality and noise
- ADF test (statsmodels
adfuller) — tests for a unit root, i.e. non-stationarity - SARIMA / SARIMAX (statsmodels) — forecasting model with a seasonal block
- auto_arima (pmdarima) — automatic search of model orders
- pandas, Matplotlib — data frame and plots
Google or a one-time email code. No password.