Description Usage Arguments Value Examples
View source: R/INTRA_FORECAST_calculate_forecast_errors.R
calculate_forecast_errors
is a function to combine the fc_data from
each forecast model within the named list fc_models and combine it with
actuals data from the validation time series object, in order to calculate
the forecast errors.
1 2 3 4 5 6 | calculate_forecast_errors(
fc_models,
ts_object_train,
ts_object_valid,
allow_negative_fc = F
)
|
fc_models |
A named list of forecast models, with for each forecast model a list with the model itself and a table with forecast values. |
ts_object_train |
A time series object, which contains only the training data. |
ts_object_valid |
A time series object, which contains only the validation data. |
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. |
A tibble with data on the fc errors for all the forecast models in fc_models.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ts_object_both <- tstools::initialize_ts_forecast_data(
data = dummy_gasprice,
date_col = "year_month",
col_of_interest = "gasprice",
group_cols = c("state", "oil_company")
) %>%
dplyr::filter(grouping == "state = New York & oil_company = CompanyA") %>%
tstools::transform_data_to_ts_object() %>%
split_ts_object(ts_split_date = 200301)
calculate_forecast_errors(
fc_models = add_all_univariate_forecast_models(
ts_object_train = ts_object_both$train,
periods_ahead = 12,
fc_methods = c("basic", "linear", "prophet")
),
ts_object_train = ts_object_both$train,
ts_object_valid = ts_object_both$valid
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.