Skip to contents

This function scores the weighted interval scoring (WIS) for a given forecast data against the truth.

Usage

score_WIS(
  forecast_data,
  truth,
  ingest = c("dataframe", "path", "list"),
  missing = c("remove", "zero")
)

Arguments

forecast_data

A dataframe,directory path,or list object providing forecast data with columns including: model, date, location_name, forecast_date, quantile, and value. Can also be a path or a list of paths to csv files.

truth

A dataframe containing the true values to compare the forecast data against, with columns including: date, location_name, and value.

ingest

A character vector specifying the type of input for 'forecast_data', which can be either "dataframe", "path", or "list".

missing

A character vector specifying the method to handle missing true values in the scoring process. It can be either "remove" or "zero".

Value

Returns a dataframe with scores for each model, date, location, and forecast_date combination based on the WIS metric.

Examples

# score the WIS for some example forecast and truth dataframes
library(scoringutils)
example_forecast <- data.frame(model = c("model1","model2"), date = as.Date(c("2020-06-01","2020-06-02")),
location_name = c("location1","location2"), forecast_date = as.Date(c("2020-06-03","2020-06-04")),
quantile = 0.5, value = c(10,20))
example_truth <- data.frame(date = as.Date(c("2020-06-03","2020-06-04")), location_name = c("location1","location2"), value = c(8,22))
score_WIS(example_forecast, example_truth, "dataframe", "remove")
#> Error in mutate(., prediction = value, model = model, date = as.Date(target_end_date),     forecast_date = as.Date(forecast_date), location_name = location):  In argument: `date = as.Date(target_end_date)`.
#> Caused by error in `as.Date()`:
#> ! object 'target_end_date' not found