Methods that power time_decompose()

decompose_twitter(data, target, frequency = "auto", trend = "auto",
  message = TRUE)

decompose_stl(data, target, frequency = "auto", trend = "auto",
  message = TRUE)

Arguments

data

A tibble or tbl_time object.

target

A column to apply the function to

frequency

Controls the seasonal adjustment (removal of seasonality). Input can be either "auto", a time-based definition (e.g. "2 weeks"), or a numeric number of observations per frequency (e.g. 10). Refer to time_frequency().

trend

Controls the trend component For stl, the trend controls the sensitivity of the lowess smoother, which is used to remove the remainder. For twitter, the trend controls the period width of the median, which are used to remove the trend and center the remainder.

message

A boolean. If TRUE, will output information related to tbl_time conversions, frequencies, and trend / median spans (if applicable).

Value

A tbl_time object containing the time series decomposition.

References

See also

time_decompose()

Examples

library(dplyr) tidyverse_cran_downloads %>% ungroup() %>% filter(package == "tidyquant") %>% decompose_stl(count)
#> frequency = 7 days
#> trend = 91 days
#> # A time tibble: 425 x 5 #> # Index: date #> date observed season trend remainder #> <date> <dbl> <dbl> <dbl> <dbl> #> 1 2017-01-01 9.00 -19.8 27.3 1.46 #> 2 2017-01-02 55.0 12.4 27.4 15.2 #> 3 2017-01-03 48.0 11.3 27.4 9.28 #> 4 2017-01-04 25.0 8.91 27.4 -11.4 #> 5 2017-01-05 22.0 9.80 27.5 -15.3 #> 6 2017-01-06 7.00 -1.26 27.5 -19.3 #> 7 2017-01-07 7.00 -21.3 27.5 0.807 #> 8 2017-01-08 32.0 -19.8 27.6 24.2 #> 9 2017-01-09 70.0 12.4 27.6 30.0 #> 10 2017-01-10 33.0 11.3 27.6 -5.95 #> # ... with 415 more rows