force_to_univariate_ts_object: Transform a time series object to be univariate

Description Usage Arguments Value Examples

View source: R/HELPER_force_to_univariate_ts_object.R

Description

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.

Usage

1

Arguments

ts_object

A time series object that can be univariate or multivariate.

Value

A univariate time series object.

Examples

 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)

ing-bank/tsforecast documentation built on Sept. 18, 2020, 9:40 a.m.