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




