4.8.1.1.19. statsmodels.tsa.api.seasonal_decompose

statsmodels.tsa.api.seasonal_decompose(x, model='additive', filt=None, freq=None)[source]
Parameters:

x : array-like

Time series

model : str {“additive”, “multiplicative”}

Type of seasonal component. Abbreviations are accepted.

filt : array-like

The filter coefficients for filtering out the seasonal component. The default is a symmetric moving average.

freq : int, optional

Frequency of the series. Must be used if x is not a pandas object with a timeseries index.

Returns:

results : obj

A object with seasonal, trend, and resid attributes.

See also

statsmodels.tsa.filters.convolution_filter

Notes

This is a naive decomposition. More sophisticated methods should be preferred.

The additive model is Y[t] = T[t] + S[t] + e[t]

The multiplicative model is Y[t] = T[t] * S[t] * e[t]

The seasonal component is first removed by applying a convolution filter to the data. The average of this smoothed series for each period is the returned seasonal component.