Time Series • Statistics Background for Forecasting
Time Series / P3.05 Fit a Simple AR Model

P3.05 Fit a Simple AR Model

Practical 3 Statistics Background for Forecasting

Fit AR(1) to the constructed persistent series. Explain the coefficient in words.

Practical / Solution

P3.05 Fit a Simple AR Model

Problem Statement

Fit AR(1) to the constructed persistent series. Explain the coefficient in words.

Learning Outcomes

  • Fit AutoReg or ARIMA with MA terms shut off.
  • Interpret a coefficient near 0.7 as persistence.

Theory

An AR(1) model says today's value depends on yesterday's value plus noise. The coefficient should be less than 1 in absolute value for a weakly stationary AR(1).

Dataset / Data Source

Same AR(1)-like construction as P3.03.

Analysis / Program

import numpy as np import pandas as pd from statsmodels.tsa.ar_model import AutoReg rng = np.random.default_rng(5) e = rng.normal(size=120) y = np.zeros(120) for t in range(1, 120): y[t] = 0.7 * y[t-1] + e[t] y = pd.Series(y) model = AutoReg(y, lags=1, old_names=False).fit() print(model.summary())

Expected Output

A statsmodels summary with an AR lag-1 coefficient. In this construction it should be around 0.7, but the fitted number will not be exact.

Result / Interpretation

A coefficient near 0.7 means a high value tends to be followed by another fairly high value. That is persistence, not a seasonal model.

Note

Fit a simple AR only after plots suggest short-lag dependence and the series looks reasonably stable in level.