seas_adj: Seasonal adjustment helper function

View source: R/gtseas_adj.R

seas_adjR Documentation

Seasonal adjustment helper function

Description

seas_adj takes a tibble of time series and returns a tibble with seasonal adjusted values.

Usage

seas_adj(series, freq = "month", log.trafo = F, method = "arima")

Arguments

series

The input tibble in tidy form with columns time, value and optional column id. Monthly or quarterly frequency.

log.trafo

Logical, indicates if value should be transformed to log(value).

method

Character, which method for adjustment should be choosen. See Details.

Value

Returns a tibble with seasonal adjusted values and a date column.

For method, there can be choosen "firstdiff" and "arima". If "firstdiff", first derivatives with lag = 1 are computed. If "arima", the X-13ARIMA-SEATS procedure is used (performed by seasonal::seas() from the seasonal package).

Examples

series <- trendecon::ts_gtrends(c("ikea", "saturn"), time = "2020-01-01 2021-06-01")
gtseas_adj(series, freq = "month", log.traf = TRUE, method = "firstdiff")

johannes97s/ifwtrends documentation built on Oct. 9, 2022, 7:01 p.m.