Description Usage Arguments Value Examples
View source: R/HELPER_force_to_univariate_ts_object.R
force_to_univariate_ts_object
is a function to transform a time series
object into a univariate time series object. This is needed to run i.a. the
linear forecasting functions, since they require a univariate time series
object as an input. The external regressors are dropped so that only the
column of interest remains in the resulting univariate time series object.
1 | force_to_univariate_ts_object(ts_object)
|
ts_object |
A time series object that can be univariate or multivariate. |
A univariate time series object.
1 2 3 4 5 6 7 8 9 10 | 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 = CompanyA") %>%
tstools::transform_data_to_ts_object(seasonal_periods = c(12,3))
force_to_univariate_ts_object(ts_object = ts_object)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.