STL: Multiple seasonal decomposition by Loess

View source: R/stl.R

STLR Documentation

Multiple seasonal decomposition by Loess

Description

Decompose a time series into seasonal, trend and remainder components. Seasonal components are estimated iteratively using STL. Multiple seasonal periods are allowed. The trend component is computed for the last iteration of STL. Non-seasonal time series are decomposed into trend and remainder only. In this case, supsmu is used to estimate the trend. Optionally, the time series may be Box-Cox transformed before decomposition. Unlike stl, mstl is completely automated.

Usage

STL(formula, iterations = 2, ...)

Arguments

formula

Decomposition specification (see "Specials" section).

iterations

Number of iterations to use to refine the seasonal component.

...

Other arguments passed to stats::stl().

Value

A fabletools::dable() containing the decomposed trend, seasonality and remainder from the STL decomposition.

Specials

trend

The trend special is used to specify the trend extraction parameters.

trend(window, degree, jump)
window The span (in lags) of the loess window, which should be odd. If NULL, the default, nextodd(ceiling((1.5*period) / (1-(1.5/s.window)))), is taken.
degree The degree of locally-fitted polynomial. Should be zero or one.
jump Integers at least one to increase speed of the respective smoother. Linear interpolation happens between every jumpth value.

season

The season special is used to specify the season extraction parameters.

season(period = NULL, window = NULL, degree, jump)
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").
window The span (in lags) of the loess window, which should be odd. If the window is set to "periodic" or Inf, the seasonal pattern will be fixed. The window size should be odd and at least 7, according to Cleveland et al. The default (NULL) will choose an appropriate default, for a dataset with one seasonal pattern this would be 11, the second larger seasonal window would be 15, then 19, 23, ... onwards.
degree The degree of locally-fitted polynomial. Should be zero or one.
jump Integers at least one to increase speed of the respective smoother. Linear interpolation happens between every jumpth value.

lowpass

The lowpass special is used to specify the low-pass filter parameters.

lowpass(window, degree, jump)
window The span (in lags) of the loess window of the low-pass filter used for each subseries. Defaults to the smallest odd integer greater than or equal to the seasonal period which is recommended since it prevents competition between the trend and seasonal components. If not an odd integer its given value is increased to the next odd one.
degree The degree of locally-fitted polynomial. Must be zero or one.
jump Integers at least one to increase speed of the respective smoother. Linear interpolation happens between every jumpth value.

References

R. B. Cleveland, W. S. Cleveland, J.E. McRae, and I. Terpenning (1990) STL: A Seasonal-Trend Decomposition Procedure Based on Loess. Journal of Official Statistics, 6, 3–73.

See Also

stl, supsmu

Examples

as_tsibble(USAccDeaths) %>%
  model(STL(value ~ trend(window = 10))) %>%
  components()


tidyverts/tsibblestats documentation built on March 18, 2024, 9:47 a.m.