Description Usage Arguments Value Examples
View source: R/INTRA_FORECAST_decompose_ts_object_for_ML.R
decompose_ts_object_for_ML
Add columns to a time series object that
contains features of the time variable, including a periods column. This is
in order to prepare the dataset for models that are not suited to handle time
series objects like CART trees or RandomForest forests.
1 2 3 4 5 6 | decompose_ts_object_for_ML(
ts_object,
filter_stationary = T,
filter_date_features = F,
add_xreg_deltas = T
)
|
ts_object |
A time series object, with the column of interest. It can also contain external regressor columns. |
filter_stationary |
Boolean, indicating whether to filter out stationary
features of the decomposed time series. For instance, if data contains
monthly data, then the "minute" feature will be the same across all
periods. Setting |
filter_date_features |
Boolean, indicating whether to filter out any column that contains a date feature (TRUE) or not (FALSE). This can be used for forecast methods which are not able to handle date objects as features. |
add_xreg_deltas |
Boolean, indicating whether to add as additional column(s) the deltas between consecutive rows for the external regressor column(s) (TRUE) or not (FALSE). |
A tibble that contains the original variable(s) along with date featurs as additional columns
1 2 3 4 5 6 7 8 9 10 | 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 = CompanyA") %>%
tstools::transform_data_to_ts_object() %>%
decompose_ts_object_for_ML()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.