classical_decomposition | R Documentation |
Decompose a time series into seasonal, trend and irregular components using moving averages. Deals with additive or multiplicative seasonal component.
classical_decomposition(formula, type = c("additive", "multiplicative"), ...)
formula |
Decomposition specification (see "Specials" section). |
type |
The type of seasonal component. Can be abbreviated. |
... |
Other arguments passed to |
The additive model used is:
Y_t = T_t + S_t + e_t
The multiplicative model used is:
Y_t = T_t\,S_t\, e_t
The function first determines the trend component using a moving
average (if filter
is NULL
, a symmetric window with
equal weights is used), and removes it from the time series. Then,
the seasonal figure is computed by averaging, for each time unit, over
all periods. The seasonal figure is then centered. Finally, the error
component is determined by removing trend and seasonal figure
(recycled as needed) from the original time series.
This only works well if x
covers an integer number of complete
periods.
A fabletools::dable()
containing the decomposed trend, seasonality
and remainder from the classical decomposition.
The season
special is used to specify seasonal attributes of the decomposition.
season(period = NULL)
period | The periodic nature of the seasonality. This can be either a number indicating the number of observations in each seasonal period, or text to indicate the duration of the seasonal window (for example, annual seasonality would be "1 year"). |
as_tsibble(USAccDeaths) %>%
model(classical_decomposition(value)) %>%
components()
as_tsibble(USAccDeaths) %>%
model(classical_decomposition(value ~ season(12), type = "mult")) %>%
components()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.