Time Series • Introduction to Autoregressive Models and Forecasting
Time Series / Forecasting using Seasonal ARIMA Models

Forecasting using Seasonal ARIMA Models

Notes 4 Introduction to Autoregressive Models and Forecasting

Forecasting using Seasonal ARIMA means fitting a SARIMA model whose seasonal period matches the data, then producing future values that can continue the historical seasonal shape as well as any non-seasonal movement the model allows.

Notes

Forecasting using Seasonal ARIMA Models

Definition

Forecasting using Seasonal ARIMA means fitting a SARIMA model whose seasonal period matches the data, then producing future values that can continue the historical seasonal shape as well as any non-seasonal movement the model allows.

Example

Two years of monthly sales with a yearly peak can be fit with a small SARIMA and m = 12, using the last year as a hold-out if the series is long enough.

Practical Workflow

Seasonal Time Series ↓ Visualize ↓ Identify Seasonality ↓ Check Stationarity ↓ Seasonal / Non-seasonal Differencing if Required ↓ Select Candidate SARIMA ↓ Fit Model ↓ Diagnose ↓ Forecast ↓ Evaluate
  1. Visualize: plot the series and look for a repeating wave.
  2. Identify seasonality: choose m from the calendar and from lag-m ACF (for example m = 12).
  3. Check stationarity: see whether the level wanders and whether seasonal peaks grow or stay similar.
  4. Difference if required: ordinary d for nearby wandering; seasonal D for a repeating seasonal level. Use only what the plot supports.
  5. Select a candidate: start with a small seasonal model, not a huge search.
  6. Fit: estimate on training months.
  7. Diagnose: residual ACF should not keep a large seasonal spike if the seasonal part is adequate.
  8. Forecast: future months, with interval bands that widen with the horizon.
  9. Evaluate: MAE or RMSE on later months not used in fitting.

Interpretation, a Small SARIMA Example, and Unit 3 Quick Revision

How to Read a Seasonal Forecast

If the historical series peaks every December, a useful SARIMA forecast should still show a similar seasonal wiggle, unless the data have clearly changed. If the forecast is a flat line while the history is strongly seasonal, the seasonal orders or m may be wrong. Performance is still judged by error measures on hold-out dates, not by how attractive the in-sample plot looks.

A forecast interval is a model-based range for a future observation. It is not a promise that the actual value must fall inside the band.

Small Educational Python Example

Constructed 72 monthly points with trend and a yearly wave (airline-passenger-like in spirit, not a downloaded file). A small SARIMA is fit on the first 60 months. Expected display: a model summary, a 12-month forecast line that still wiggles yearly, and a hold-out MAE. Exact MAE depends on the run.

# Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt from statsmodels.tsa.statespace.sarimax import SARIMAX # Load / prepare a monthly seasonal teaching series idx = pd.date_range("2019-01-01", periods=72, freq="MS") t = np.arange(72) y = pd.Series(0.4 * t + 8 * np.sin(2 * np.pi * t / 12) + 50, index=idx) train, test = y.iloc[:-12], y.iloc[-12:] # Fit a small SARIMA: non-seasonal (0,1,1), seasonal (0,1,1,12) fit = SARIMAX( train, order=(0, 1, 1), seasonal_order=(0, 1, 1, 12), enforce_stationarity=False, enforce_invertibility=False ).fit(disp=False) # Generate forecast fc = fit.get_forecast(12).predicted_mean mae = np.mean(np.abs(test - fc)) print(fit.summary()) print("Hold-out MAE:", round(mae, 3)) # Plot forecast train.plot(label="train") test.plot(label="test") fc.plot(label="SARIMA forecast", style="--") plt.legend() plt.title("Seasonal ARIMA history vs 12-month forecast") plt.tight_layout() plt.show()
Exam Note

For monthly seasonal forecasting, state m = 12, fit on earlier months, and check that the forecast still follows the seasonal pattern and is evaluated on later months.

Unit 3 Quick Revision

Term Short definition / exam point
Autocorrelation Correlation of a series with its lagged values.
Partial autocorrelation Lag-k correlation after accounting for intermediate lags.
AR Current value depends on past values. AR(1): Xt = c + φ Xt−1 + εt.
MA Current value depends on past errors. MA(1): Xt = μ + εt + θ εt−1.
ARMA AR + MA for a roughly stationary series; orders (p, q).
ARIMA ARMA plus differencing; orders (p, d, q). d is not always needed.
Forecasting using ARIMA Fit on training dates, check residuals, forecast, evaluate on later dates.
Seasonal data Repeating pattern at known period m. Not the same as trend or cycle.
SARIMA Seasonal ARIMA: (p, d, q)(P, D, Q)m.
Forecasting using SARIMA Include m, possibly seasonal differencing, then forecast and evaluate.

Compact model-selection intuition:

ACF / PACF / stationarity / seasonality ↓ Candidate Model ↓ Fit ↓ Diagnose ↓ Forecast ↓ Evaluate
  1. ACF vs PACF: overall lag correlation vs direct lag-k correlation.
  2. AR vs MA: past values vs past shocks.
  3. ARMA vs ARIMA: no built-in differencing vs optional d.
  4. Non-seasonal vs seasonal differencing: lag 1 vs lag m.
  5. ARIMA vs SARIMA: no seasonal orders vs (P, D, Q)m.