pmdarima.arima.decompose(x, type_, m, filter_=None)[source][source]

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.

type_: str

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.

m: int

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 x, trend, seasonal, and random components where x is the input signal, trend is the overall trend, seasonal is the seasonal component, and random is the noisy component. The input signal x can be mostly reconstructed by the other three components with a number of points missing equal to m.


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 examples folder of the repo and the Examples section of the docs as well.


[R71]Example of decompose using both multiplicative and additive types:
[R72]R documentation for decompose: