get_fc_periods: Determine forecasting periods for ts object

Description Usage Arguments Value Examples

View source: R/HELPER_get_fc_periods.R

Description

get_fc_periods is a function which creates a vector of periods to be forecasted given the training data and intended forecasting periods ahead.

Usage

1
get_fc_periods(ts_object_train, periods_ahead)

Arguments

ts_object_train

A time series object, representing the training data for the forecast.

periods_ahead

A positive integer value indicating the number of periods ahead to be forecasted (e.g. 24 for 2 years ahead forecasting using monthly data).

Value

A vector of periods in numeric yyyymm format, of length periods_ahead and starting after the periods available in ts_object_train.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  ts_object_train <- 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 = 3)
  get_fc_periods(ts_object_train = ts_object_train, periods_ahead = 10)

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