Description Usage Arguments Details Value Examples
View source: R/HELPER_get_seasonality_additive.R
get_seasonality_additive
is a function to get seasonality for a time
series object and the seasonality is returned as a vector of integer values.
1 | get_seasonality_additive(ts_object, top_num = 2)
|
ts_object |
A time series object containing the values for the
column_of_interest, which has been created using the
|
top_num |
An int number to specify how many seasonality patterns that need to be detected, the default value is 2. |
The function will, for a time series object (mostly, one group of data), get seasonality pattern returned as a vector. The number of seasonality pattern detected is defined as a input parameter of the function, and it represents the top n significant seasonality pattern found.
seasonality: A vector containing seasonality patterns discovered. For example, (12, 3). If the ts_object is monthly time series object, it means the seasonality is 12 months and 3 months.
1 2 3 4 5 6 7 8 9 10 11 | ts_object <- tstools::initialize_ts_forecast_data(
data = dummy_gasprice,
date_col = "year_month",
col_of_interest = "gasprice",
group_cols = c("state", "oil_company"),
xreg_cols = c("spotprice", "gemprice")
)%>%
dplyr::filter(grouping == "state = New York & oil_company = CompanyB") %>%
dplyr::select(period, col_of_interest, grouping) %>%
tstools::transform_data_to_ts_object(seasonal_periods = 1)
get_seasonality_additive(ts_object, top_num = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.