Description Usage Arguments Value Examples
View source: R/INTRA_FORECAST_add_fc_models_to_main_forecasting_table.R
add_fc_models_to_main_forecasting_table
is a function to extend the
main forecasting table with an additional column, called fc_models, in which
all the specified forecast methods are stored after they have been run. The
forecast methods are run for each row of parameters and time series data in
the main forecasting table. The resulting fc_models column consists of a
named lists with forecast models and forecast data.
1 2 3 4 5 6 7 8 9 10 11 12 | add_fc_models_to_main_forecasting_table(
main_forecasting_table,
periods_ahead = 12,
fc_methods = supported_fc_methods_uni_var(),
overwrite_fc = FALSE,
add_fc_errors = TRUE,
allow_negative_fc = FALSE,
keep_fc_model_objects = FALSE,
verbose = FALSE,
parallel = TRUE,
max_cores = Inf
)
|
main_forecasting_table |
A tibble containing several columns of data
required for time series forecasting, which has been created using the
|
periods_ahead |
A positive integer value indicating the number of periods to forecast ahead. |
fc_methods |
A character vector specifying the forecast methods to add.
For more info |
overwrite_fc |
Boolean, which is set to TRUE if all existing forecasts should be overwritten, or set to FALSE if only unavailable forecasts should be added. Needs to be set to true if the @param main_forecasting_table already has forecasts of different @param periods_ahead. |
add_fc_errors |
Boolean, which is set to TRUE if
|
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. |
keep_fc_model_objects |
Boolean, which is set to TRUE in order to keep original fc_model objects in the main_forecasting_table after running the forecast. This is needed for scenario analysis in multivariate forecasting. However, it may lead to memory issues, as the main_forecasting_table increases in size. |
verbose |
Boolean, which is set to TRUE if status updates are valued, or set to FALSE if they are not. |
parallel |
Boolean, which is set to TRUE if each row of the main_forecast_table should be ran in parallel (using #logical cores - 1), or set to FALSE if they are not. |
max_cores |
A positive integer value indicating the maximum number of cores to use for running the forecasts in parallel. |
A tibble containing several columns of data required for time series forecasting, extended with as an additional column, called fc_models, with named lists with forecast models and forecast data.
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)
) %>%
head(15)
main_forecasting_table <- add_fc_models_to_main_forecasting_table(
main_forecasting_table,
periods_ahead = 12,
fc_methods = c("basic", "tree", "forest", "prophet")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.