This function takes in forecast data and truth data, compares models and plots the relative overall performance over time. Multiple file ingest formats are available. The function can be scaled using a specified model for normalization. Graphics are written to file.
Arguments
- forecast_data
A dataframe containing forecast predictions as exported from the RAPIDD API, or a list of such dataframes.
- ingest
A character string specifying the format of the
forecast_data
input. Can be one of 'dataframe', 'path' or 'list'. Defaults to 'dataframe'.- hub_forecasts
(optional) A dataframe containing hub forecasts predictions as exported from the RAPIDD API.
- truth
A dataframe containing true values.
- missing
A character string specifying how to handle missing values in the true values dataset. Can be one of 'remove' or 'zero'. Default is 'remove'.
- scale_model
(optional) A character string specifying the name of the model to use as a reference for scaling scores.
- limit
(optional) A numeric value for the upper limit of the score scale. Default is NULL.
- write_copy
(optional) Logical indicating whether to save outputs to the current working directory. Default is TRUE.
Value
A ggplot2 object that shows the relative overall performance of different models compared to each other.
Details
The function applies the scoringutils::score() function to calculate interval scores (WIS), then performs a normalization step if scale_model
is provided. Graphics are written to file in the current working directory.
Examples
# Load example data
data('example_test_forecasts')
#> Warning: data set 'example_test_forecasts' not found
data('example_hub_forecasts')
#> Warning: data set 'example_hub_forecasts' not found
data('example_truth_data')
#> Warning: data set 'example_truth_data' not found
# Plot comparison of forecasts, with test data input as a dataframe
plot_forecasts_compare(forecast_data = example_test_forecasts,
hub_forecasts = example_hub_forecasts,
truth = example_truth_data)
#> Error in plot_forecasts_compare(forecast_data = example_test_forecasts, hub_forecasts = example_hub_forecasts, truth = example_truth_data): object 'example_test_forecasts' not found