decompose(x, type_, m, filter_=None)¶
Decompose the time series into trend, seasonal, and random components.
x : np.array, shape=(n_samples,)
The time series of which the trend, seasonal, and noise/random components will be extracted.
The type of decomposition that will be performed - ‘multiplicative’ or ‘additive’. We would use ‘multiplicative’ generally when we see an increasing trend. We use ‘additive’ when the trend is relatively stable over time.
The frequency in terms of number of observations. This behaves similarly to R’s frequency for a time series (ts).
filter_: np.array, optional (default=None)
A filter by which the convolution will be performed.
decomposed_tuple : namedtuple
A named tuple with
xis the input signal,
trendis the overall trend,
seasonalis the seasonal component, and random is the noisy component. The input signal
xcan be mostly reconstructed by the other three components with a number of points missing equal to
This function is generally used in conjunction with
pmdarima.utils.visualization.decomposed_plot(), which plots the decomposed components. Also there is an example script in the
examplesfolder of the repo and the
Examplessection of the docs as well.
[R71] Example of decompose using both multiplicative and additive types: https://anomaly.io/seasonal-trend-decomposition-in-r/index.html [R72] R documentation for decompose: https://www.rdocumentation.org/packages/stats/versions/3.6.1/topics/decompose