get_consistent_fc_values: Calculate consistent hierarchical forecast values

Description Usage Arguments Value Examples

View source: R/HELPER_get_consistent_fc_values.R

Description

get_consistent_fc_values is a function that calculates the consistent hierarchical forecasting values, based on already calculated forecasts.

Usage

1
get_consistent_fc_values(main_forecasting_table, best_model_per_group)

Arguments

main_forecasting_table

A tibble object that contains run forecasts for one split date and all groups. It is assumed that this is the output of the add_fc_models_to_main_forecasting_table or update_main_forecasting_table function.

best_model_per_group

A tibble that containts the best fc_model for each group. It is assumed that this tibble is created using the get_forecast_accuracy_overview and get_best_forecast_methods functions (see example).

Value

A tibble with the consistent hierarchical forecast value for all groups in all forecast dates, at the specified forecast split date

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
main_forecasting_table <- dummy_hierarchical_gasprice %>%
   dplyr::filter(oil_company == "CompanyA") %>%
   tstools::initialize_ts_forecast_data(
      date_col = "year_month",
      col_of_interest = "gasprice",
      group_cols = "currency",
      hierarchical_col = "location"
   ) %>%
   dplyr::filter(period >= as.Date("2004-06-30")) %>%
   create_main_forecasting_table() %>%
   dplyr::filter(ts_split_date == 200606) %>%
   add_fc_models_to_main_forecasting_table(
      fc_methods = c("basic", "linear")
   )
best_model_per_group <- main_forecasting_table %>%
   get_forecast_accuracy_overview() %>%
   get_best_forecast_methods()
get_consistent_fc_values(
   main_forecasting_table = main_forecasting_table,
   best_model_per_group = best_model_per_group
)

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