compare_forecasts_with_actuals: Create plot to compare forecasts with actuals

Description Usage Arguments Value Examples

View source: R/VISUALIZE_compare_forecasts_with_actuals.R

Description

compare_forecasts_with_actuals is a function to create a plot which compares the forecasted values with the actuals (if already available) for a set of specified forecast models. For demo purposes, sensitive figures can be hidden from the audience.

Usage

1
2
3
4
5
6
compare_forecasts_with_actuals(
  main_forecasting_table,
  fc_models = c(),
  demo_mode = FALSE,
  show_original = TRUE
)

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 display.

demo_mode

Boolean, which is to be set to TRUE if any potentially sensitive figures should be hidden from the audience for demo purposes, or set to FALSE if all figures can safely be displayed.

show_original

Boolean, which is set to TRUE to include the original actuals in the plot.

Value

A plotly object displaying both forecasts and actuals.

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")
   ) %>%
   compare_forecasts_with_actuals(
      fc_models = c("fc_linear_trend", "fc_linear_trend_seasonal")
   )

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