gtseas_adj | R Documentation |
This function can either seasonal adjust a given time series or create a new time series based on a Google Trends search query and then directly seasonally adjust it.
gtseas_adj( timeseries = NULL, keyword = NA, category = NA, geo = "DE", timeframe = paste("2006-01-01", Sys.Date()), method = "arima", freq = "monthly", log.trafo = FALSE )
timeseries |
A already created time series to seasonal adjust. Preferably already as tsibble or tibble. If another data format is given, it will be coerced to a tsibble. |
keyword |
A vector (chr) of keywords to search for. |
category |
A vector (numeric) of category numbers to search for. |
geo |
The region to search in. |
timeframe |
A time frame to search the queries in consisting of a start date and an end date in YYYY-MM-DD form. |
method |
Character, which method for adjustment should be choosen. See Details. |
freq |
Character "month" or "quarter" for the frequency. |
log.trafo |
Logical, indicates if value should be transformed to log(value). |
Returns a tsibble with sesonal adjusted values and a date column. Any key column will be lost. Therefore, you should only to this with single time series with one keyword or category.
With the seasonal adjustment method,
a choice can be made between "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).
series <- trendecon::ts_gtrends(c("ikea", "saturn"), time = "2020-01-01 2021-06-01") gtseas_adj(series, freq = "month", log.traf = TRUE, method = "firstdiff") gtseas_adj(category = 179, timeframe = "2015-01-01 2021-01-01", method = "arima")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.