| tidiers_stl {sweep} | R Documentation |
Tidying methods for STL (Seasonal, Trend, Level) decomposition of time series
## S3 method for class 'stl' sw_tidy(x, ...) ## S3 method for class 'stl' sw_tidy_decomp(x, timetk_idx = FALSE, rename_index = "index", ...) ## S3 method for class 'stlm' sw_tidy_decomp(x, timetk_idx = FALSE, rename_index = "index", ...)
x |
An object of class "stl" or "stlm" |
... |
Not used. |
timetk_idx |
Used with |
rename_index |
Used with |
sw_tidy() wraps sw_tidy_decomp()
sw_tidy_decomp() returns a tibble with the following time series attributes:
index: An index is either attempted to be extracted from the model or
a sequential index is created for plotting purposes
season: The seasonal component
trend: The trend component
remainder: observed - (season + trend)
seasadj: observed - season (or trend + remainder)
library(dplyr)
library(forecast)
library(sweep)
fit_stl <- USAccDeaths %>%
stl(s.window = "periodic")
sw_tidy_decomp(fit_stl)