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

Forecasting using ARIMA

Notes 4 Introduction to Autoregressive Models and Forecasting

Forecasting using ARIMA means fitting a justified ARIMA(p, d, q) model to historical data and then using that model to estimate future values. The forecast is the model's expected future path, not a guarantee.

Notes

Forecasting using ARIMA

Definition

Forecasting using ARIMA means fitting a justified ARIMA(p, d, q) model to historical data and then using that model to estimate future values. The forecast is the model's expected future path, not a guarantee.

Example

Monthly shop sales that wander in level may be differenced once and then given a small ARIMA, using earlier months to fit and later months to check the forecast.

General Workflow

Historical Time Series ↓ Inspect / Clean ↓ Check Stationarity ↓ Difference if Required ↓ Identify Candidate Model ↓ Fit ARIMA ↓ Diagnose Residuals ↓ Forecast ↓ Evaluate
  1. Inspect / clean: plot the series, fix obvious errors, keep time order.
  2. Check stationarity: look at level, variation and whether ACF decays very slowly.
  3. Difference if required: use d = 1 only when the plot/ACF justify it.
  4. Identify a candidate: use ACF/PACF of the (differenced) series to suggest small p and q. This is a candidate, not a final proof.
  5. Fit ARIMA: estimate the model on training (earlier) dates.
  6. Diagnose residuals: leftover ACF should look closer to noise; patterns mean the model is incomplete.
  7. Forecast: produce future values. A forecast interval is a range that is intended to cover the future observation with a stated probability under the model; it widens as the horizon grows.
  8. Evaluate: compare forecasts with test (later) dates using MAE or RMSE when possible.

Training Data, Test Data and Fitting

Training data are used to estimate p, d, q and the coefficients. Test data are later observations held back so that forecast accuracy is not judged only on the fitted sample. Fitting means estimating the ARIMA coefficients from the training series.

Diagnostics, Intervals and a Simple ARIMA Forecast Example

Why Residuals Should Be Examined

If residuals still show trend, seasonality or strong ACF, the ARIMA mean/error structure is not capturing the series. A pretty in-sample plot is not enough. Residual plots and residual ACF are part of forecasting using ARIMA.

What a Forecast Plot Should Show

A useful plot shows the historical series, the forecast path, and often an interval band. For a pure random-walk style ARIMA(0, 1, 0), the mean forecast stays near the last training value. For models with AR/MA terms, the short-run path can move, then settle. Students should describe that shape from their own run, not memorise invented numbers.

Small Educational Python Example

Constructed teaching series (not a downloaded file). Fit a simple ARIMA(0, 1, 0) on all but the last six points. Expected display: a six-step forecast table, a hold-out MAE, and a plot of train, test and forecast. The mean forecast should stay near the last training level for this construction.

# Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt from statsmodels.tsa.arima.model import ARIMA # Load / prepare a wandering teaching series rng = np.random.default_rng(4) y = pd.Series(np.cumsum(rng.normal(size=80))) train, test = y.iloc[:-6], y.iloc[-6:] # Fit model on training dates only fit = ARIMA(train, order=(0, 1, 0)).fit() # Generate forecast fc = fit.get_forecast(steps=6) mean = fc.predicted_mean mae = np.mean(np.abs(test.values - mean.values)) print(mean) print("Hold-out MAE:", round(mae, 3)) # Plot forecast train.plot(label="train") test.plot(label="test") mean.plot(label="forecast", style="--") plt.legend() plt.title("ARIMA(0,1,0) history vs forecast") plt.tight_layout() plt.show()

Exam-Oriented Key Points

  1. Fit ARIMA on earlier dates; evaluate on later dates when possible.
  2. Difference only if stationarity checks suggest it.
  3. Examine residuals before trusting the forecast.
  4. Forecast intervals widen with the horizon; they are model-based ranges, not promises.