statsmodels.tsa.ar_model.AutoReg.predict

AutoReg.predict(params, start=None, end=None, dynamic=False, exog=None, exog_oos=None)[source]

In-sample prediction and out-of-sample forecasting.

Parameters:
paramsarray_like

The fitted model parameters.

startint, str, or datetime, optional

Zero-indexed observation number at which to start forecasting, i.e., the first forecast is start. Can also be a date string to parse or a datetime type. Default is the the zeroth observation.

endint, str, or datetime, optional

Zero-indexed observation number at which to end forecasting, i.e., the last forecast is end. Can also be a date string to parse or a datetime type. However, if the dates index does not have a fixed frequency, end must be an integer index if you want out-of-sample prediction. Default is the last observation in the sample. Unlike standard python slices, end is inclusive so that all the predictions [start, start+1, …, end-1, end] are returned.

dynamic{bool, int, str, datetime, Timestamp}, optional

Integer offset relative to start at which to begin dynamic prediction. Prior to this observation, true endogenous values will be used for prediction; starting with this observation and continuing through the end of prediction, forecasted endogenous values will be used instead. Datetime-like objects are not interpreted as offsets. They are instead used to find the index location of dynamic which is then used to to compute the offset.

exogarray_like

A replacement exogenous array. Must have the same shape as the exogenous data array used when the model was created.

exog_oosarray_like

An array containing out-of-sample values of the exogenous variable. Must has the same number of columns as the exog used when the model was created, and at least as many rows as the number of out-of-sample forecasts.

Returns:
predictions{ndarray, Series}

Array of out of in-sample predictions and / or out-of-sample forecasts.


Last update: Nov 14, 2024