change_ts_object_seasonality: Add or modify the seasonality attribute of a time series...

Description Usage Arguments Value Examples

View source: R/HELPER_change_ts_object_seasonality.R

Description

change_ts_object_seasonality is a function to modify or add a seasonality attribute to an existing time series object.

Usage

1
change_ts_object_seasonality(ts_object, seasonality)

Arguments

ts_object

A time series object containing the values for the column_of_interest, which has been created using the transform_data_to_ts_object from tstools, or alternatively an empty list.

seasonality

A numerical vector indicating the seasonality to employ for the time series object, for example c(12, 3).

Value

A time series object with the specified seasonality.

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 = CompanyB") %>%
   tstools::transform_data_to_ts_object(seasonal_periods = 1)
change_ts_object_seasonality(ts_object, seasonality = c(12, 3, 4))

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