add_fc_values_all_split_dates: Add computed hierarchical forecast values, for all split...

Description Usage Arguments Value Examples

View source: R/HELPER_add_fc_values_all_split_dates.R

Description

add_fc_values_all_split_dates is a wrapper function, that adds previously computed hierarchical forecasts into the main forecasting table.

Usage

1
2
3
4
5
add_fc_values_all_split_dates(
  main_forecasting_table,
  model_types = c("consistent", "bottom-up"),
  best_model_per_group
)

Arguments

main_forecasting_table

A tibble object that contains run forecasts for all split dates 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 contains 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_cols = c("location")
  ) %>%
  dplyr::filter(period >= as.Date("2004-06-30")) %>%
  create_main_forecasting_table() %>%
  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()
add_fc_values_all_split_dates(
  main_forecasting_table = main_forecasting_table,
  model_types = c("consistent", "bottom-up"),
  best_model_per_group = best_model_per_group
)

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