add_mean_ensemble_fc_methods: Adds an mean ensemble of provided forecast methods.

Description Usage Arguments Value Examples

View source: R/POST_FORECAST_add_mean_ensemble_fc_methods.R

Description

add_mean_ensemble_fc_methods is a function to add a new forecast method after other forecast methods have been added to the main_forecast_table. It takes the average value of the given forecast methods as the forecast value.

Usage

1
2
3
4
5
add_mean_ensemble_fc_methods(
  main_forecasting_table,
  fc_models,
  fc_model_name = "fc_mean_ensemble"
)

Arguments

main_forecasting_table

A tibble containing a single row and 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 and fc_errors columns using the add_fc_models_to_main_forecasting_table function.

fc_models

A character vector specifying which forecast models to use in the ensemble.

fc_model_name

A character string specifying the name of the mean ensamble method that is added to the main_forecasting_table.

Value

The main_forecasting_table with a mean ensemble method added.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
tstools::initialize_ts_forecast_data(
      data = dummy_gasprice,
      date_col = "year_month",
      col_of_interest = "gasprice",
      group_cols = c("state", "oil_company")
   ) %>%
   create_main_forecasting_table() %>%
   head(1) %>%
   add_fc_models_to_main_forecasting_table(
      periods_ahead = 12,
      fc_methods = c("linear")
   ) %>%
   add_mean_ensemble_fc_methods(
      fc_models = c("fc_linear_trend", "fc_linear_trend_seasonal")
   )

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