Time Series • Statistics Background for Forecasting
Time Series / P3.08 Fit an ARIMA Model

P3.08 Fit an ARIMA Model

Practical 3 Statistics Background for Forecasting

A random-walk-like series needs differencing. Compare ARIMA(0,1,0) with ARIMA(1,1,0) and explain d = 1.

Practical / Solution

P3.08 Fit an ARIMA Model

Problem Statement

A random-walk-like series needs differencing. Compare ARIMA(0,1,0) with ARIMA(1,1,0) and explain d = 1.

Learning Outcomes

  • Explain differencing as removing a wandering level.
  • Choose d from plots, not at random.

Theory

ARIMA(p,d,q) adds differencing. d = 1 means model the changes. A random walk is ARIMA(0,1,0). If ACF of the raw series decays very slowly, try differences and then identify p and q on the differenced series.

Dataset / Data Source

Constructed cumulative-sum series of length 100.

Analysis / Program

import numpy as np import pandas as pd from statsmodels.tsa.arima.model import ARIMA from statsmodels.tsa.stattools import acf rng = np.random.default_rng(2) y = pd.Series(np.cumsum(rng.normal(size=100))) print("ACF raw lag1:", round(acf(y, nlags=1, fft=True)[1], 3)) print("ACF diff lag1:", round(acf(y.diff().dropna(), nlags=1, fft=True)[1], 3)) fit = ARIMA(y, order=(0, 1, 0)).fit() print(fit.summary())

Expected Output

Raw ACF lag 1 near 1, differenced ACF much smaller, plus a simple ARIMA(0,1,0) summary.

Result / Interpretation

d = 1 is motivated by the wandering plot and slow ACF, not by guessing (2,2,2). After differencing, remaining AR/MA terms are considered only if the differenced ACF/PACF show structure.

Note

Do not pick p,d,q arbitrarily. Start from the plot and the ACF of the differenced series.