SARIMAXResults.plot_diagnostics(variable=0, lags=10, fig=None, figsize=None, truncate_endog_names=24, auto_ylims=False, bartlett_confint=False, acf_kwargs=None)

Diagnostic plots for standardized residuals of one endogenous variable

variableint, optional

Index of the endogenous variable for which the diagnostic plots should be created. Default is 0.

lagsint, optional

Number of lags to include in the correlogram. Default is 10.

figFigure, optional

If given, subplots are created in this figure instead of in a new figure. Note that the 2x2 grid will be created in the provided figure using fig.add_subplot().

figsizetuple, optional

If a figure is created, this argument allows specifying a size. The tuple is (width, height).

auto_ylimsbool, optional

If True, adjusts automatically the y-axis limits to ACF values.

bartlett_confintbool, default True

Confidence intervals for ACF values are generally placed at 2 standard errors around r_k. The formula used for standard error depends upon the situation. If the autocorrelations are being used to test for randomness of residuals as part of the ARIMA routine, the standard errors are determined assuming the residuals are white noise. The approximate formula for any lag is that standard error of each r_k = 1/sqrt(N). See section 9.4 of [1] for more details on the 1/sqrt(N) result. For more elementary discussion, see section 5.3.2 in [2]. For the ACF of raw data, the standard error at a lag k is found as if the right model was an MA(k-1). This allows the possible interpretation that if all autocorrelations past a certain lag are within the limits, the model might be an MA of order defined by the last significant autocorrelation. In this case, a moving average model is assumed for the data and the standard errors for the confidence intervals should be generated using Bartlett’s formula. For more details on Bartlett formula result, see section 7.2 in [1].+

acf_kwargsdict, optional

Optional dictionary of keyword arguments that are directly passed on to the correlogram Matplotlib plot produced by plot_acf().


Figure instance with diagnostic plots


Produces a 2x2 plot grid with the following plots (ordered clockwise from top left):

  1. Standardized residuals over time

  2. Histogram plus estimated density of standardized residuals, along with a Normal(0,1) density plotted for reference.

  3. Normal Q-Q plot, with Normal reference line.

  4. Correlogram


[1] Brockwell and Davis, 1987. Time Series Theory and Methods [2] Brockwell and Davis, 2010. Introduction to Time Series and Forecasting, 2nd edition.

Last update: Jul 16, 2024