statsmodels.tsa.statespace.structural.UnobservedComponentsResults.plot_components

UnobservedComponentsResults.plot_components(which=None, alpha=0.05, observed=True, level=True, trend=True, seasonal=True, freq_seasonal=True, cycle=True, autoregressive=True, legend_loc='upper right', fig=None, figsize=None)[source]

Plot the estimated components of the model.

Parameters
which{‘filtered’, ‘smoothed’}, or None, optional

Type of state estimate to plot. Default is ‘smoothed’ if smoothed results are available otherwise ‘filtered’.

alphafloat, optional

The confidence intervals for the components are (1 - alpha) %

levelbool, optional

Whether or not to plot the level component, if applicable. Default is True.

trendbool, optional

Whether or not to plot the trend component, if applicable. Default is True.

seasonalbool, optional

Whether or not to plot the seasonal component, if applicable. Default is True.

freq_seasonalbool, optional

Whether or not to plot the frequency domain seasonal component(s), if applicable. Default is True.

cyclebool, optional

Whether or not to plot the cyclical component, if applicable. Default is True.

autoregressivebool, optional

Whether or not to plot the autoregressive state, if applicable. Default is True.

figFigure, optional

If given, subplots are created in this figure instead of in a new figure. Note that the 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).

Notes

If all options are included in the model and selected, this produces a 6x1 plot grid with the following plots (ordered top-to-bottom):

  1. Observed series against predicted series

  2. Level

  3. Trend

  4. Seasonal

  5. Freq Seasonal

  6. Cycle

  7. Autoregressive

Specific subplots will be removed if the component is not present in the estimated model or if the corresponding keyword argument is set to False.

All plots contain (1 - alpha) % confidence intervals.