liveBook · Manning

Autoregressive model

As explained in Statistics Every Programmer Needs

An autoregressive component models the current value of a time series as a linear function of specified previous values.

An autoregressive model estimates the current time-series value from a specified number of its own previous values. In ARIMA, the autoregressive (AR) component captures linear dependence on lagged observations, allowing historical values to inform forecasts. section 7.3.1 section 7.3

Use autoregression by following a time-aware modeling workflow:

  • Partition observations chronologically into training and test sets before preprocessing or fitting. section 7.3.7
  • Assess stationarity with visual inspection, ACF and PACF plots, and the Augmented Dickey–Fuller test. section 7.3.7
  • Apply differencing when the training series is nonstationary, then inspect the transformed correlation structure. section 7.3.7
  • Select the AR order from the observed lag structure; an AR(1) uses only the immediately preceding observation. section 7.3.1 section 7.3.8

Forecasting differenced stock prices

A daily closing-price series is split into six months of training data and one month of testing data. Because the training series is treated as nonstationary, first-order differencing is applied. ACF and PACF diagnostics on the transformed series support a simple AR(1) component, which is incorporated into an ARIMA model and used to forecast the test period. Actual and forecast values are then plotted for evaluation. section 7.3.7 section 7.3.8 section 7.3.11

>>> forecast_test = model_fit.forecast(len(test))

Forecast the test horizon directly after fitting the model. section 7.3.11

How Statistics Every Programmer Needs covers it

How deep it goes
Explains lagged relationships, stationarity preparation, ACF/PACF selection, and AR(1), but defers full ARIMA estimation details.
Examples
Uses Apple daily closing prices, first-order differences, ACF/PACF plots, and an actual-versus-forecast comparison.
What it assumes
Assumes basic time-series data handling while teaching lagged observations, stationarity, differencing, ACF, and PACF.
What you can do after
Builds an ARIMA forecasting workflow by preparing data, selecting an AR order, fitting the model, and forecasting held-out observations.
How it connects
Connects autoregression with ARIMA, differencing, stationarity, autocorrelation, partial autocorrelation, and moving average components.

Also explained in

Compare how 5 books explain autoregressive model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.