create_main_forecasting_table: Create main forecasting table.

Description Usage Arguments Value Examples

View source: R/ANTE_FORECAST_create_main_forecasting_table.R

Description

create_main_forecasting_table is a function to create a table in which every row represents a different split of the data for time series forecasting. Every row contains an overview of parameters used for splitting the data into time series objects for training and validation, as well as the training and validation time series objects themselves.

Usage

1
2
3
4
5
6
create_main_forecasting_table(
  data,
  seasonal_periods = c(12, 3),
  min_train_periods = 25,
  max_train_periods = Inf
)

Arguments

data

A tibble containing the data to be used for time series forecasting, which has been created using the initialize_ts_forecast_data function from tstools.

seasonal_periods

A vector of postive integer values indicating the number of data points that together compose a season (e.g. c(12,3) for quarterly and yearly seasonality when using monthly data). If there is no seasonality in your data, simply put in 1. If the vector is written as NULL, seasonality is detected automatically

min_train_periods

A positive integer value indicating the minimum number of periods of data required for the training time series objects.

max_train_periods

A positive integer value indicating the maximum number of periods of data to be used for the training time series objects.

Value

A tibble containing several columns of data required for time series forecasting, which correspond to:

grouping - Indicate for which grouping the forecast is performed
ts_start - The start date of the time series object used for training the forecast models
ts_split_date - The end date of the time series object used for training the forecast models, therefore corresponding to the split date that is used to divide the available time series into training and validation sets
ts_end - The end date of the time series object used for validating the forecast models, which corresponds to the latest period that is available in the dataset for this grouping
train_length - The length of the time series object (in number of observations/periods) that is used for training the forecast models, which is also the time difference between ts_start and ts_split_date
valid_length - The length of the time series object (in number of observations/periods) that is available for validating the forecast models, which is also the time difference between ts_split_date and ts_end
ts_object_train - The time series object used for training the forecast models
ts_object_valid - The time series object available for validating the forecast models

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data <- 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")
)
create_main_forecasting_table(
   data = data,
   seasonal_periods = c(12,3),
   min_train_periods = 25,
   max_train_periods = Inf
)

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