add_fc_errors_to_main_forecasting_table: Add fc errors to main forecasting table

Description Usage Arguments Value Examples

View source: R/INTRA_FORECAST_add_fc_errors_to_main_forecasting_table.R

Description

add_fc_errors_to_main_forecasting_table is a function to extend the main forecasting table with an additional column, called fc_errors, which contains the forecast values, actuals and resulting forecast errors for every forecast model in the fc_models column. By default, this function is called within the add_fc_models_to_main_forecasting_table function.

Usage

1
2
3
4
add_fc_errors_to_main_forecasting_table(
  main_forecasting_table,
  allow_negative_fc = FALSE
)

Arguments

main_forecasting_table

A tibble containing several columns of data required for time series forecasting, which has been created using the create_main_forecasting_table function and which has been extended with the fc_models column using the add_fc_models_to_main_forecasting_table function.

allow_negative_fc

Boolean, which is to be set to TRUE if negative forecast values are allowed, or set to FALSE if negative forecast values should be overwritten by a value of zero.

Value

A tibble containing several columns of data required for time series forecasting, extended with as an additional column, called fc_errors, which contains the forecast values, actuals and resulting forecast errors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data <- tstools::initialize_ts_forecast_data(
   data = dummy_gasprice,
   date_col = "year_month",
   col_of_interest = "gasprice",
   group_cols = c("state", "oil_company")
)
main_forecasting_table <- create_main_forecasting_table(
      data = data,
      seasonal_periods = c(12,3)
   ) %>%
   add_fc_models_to_main_forecasting_table(
      periods_ahead = 12,
      fc_methods = c("basic", "linear"),
      add_fc_errors = F
   ) %>%
   add_fc_errors_to_main_forecasting_table()

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