statsmodels.tsa.ar_model.AutoRegResults.plot_predict

AutoRegResults.plot_predict(start=None, end=None, dynamic=False, exog=None, exog_oos=None, alpha=0.05, in_sample=True, fig=None, figsize=None)[source]

Plot in- and out-of-sample predictions

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.

alpha{float, None}

The tail probability not covered by the confidence interval. Must be in (0, 1). Confidence interval is constructed assuming normally distributed shocks. If None, figure will not show the confidence interval.

in_samplebool

Flag indicating whether to include the in-sample period in the plot.

figFigure

An existing figure handle. If not provided, a new figure is created.

figsize: tuple[float, float]

Tuple containing the figure size values.

Returns:
Figure

Figure handle containing the plot.