statsmodels.tsa.statespace.structural.UnobservedComponentsResults.plot_components

method

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) %

levelboolean, optional

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

trendboolean, optional

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

seasonalboolean, optional

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

freq_seasonal: boolean, optional

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

cycleboolean, optional

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

autoregressiveboolean, optional

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

figMatplotlib Figure instance, 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 keywork argument is set to False.

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