wis: Weighted interval score (WIS)

View source: R/scoreForecast.R

wisR Documentation

Weighted interval score (WIS)

Description

Bracher J, Ray EL, Gneiting T, Reich NG. (2021) "Evaluating epidemic forecasts in an interval format." PLOS Computational Biology 17(2): e1008618. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1371/journal.pcbi.1008618")}

Usage

wis(observed, median_pred, quantiles)

Arguments

observed

numeric vector of realized values, length T

median_pred

numeric vector of median (or mean, if no median is available) point predictions, length T

quantiles

a named list, as returned by rt_forecast()$forecast_quantiles or directly from recurs_predict_quantiles()$quantiles: each element is a 2 x T matrix with rows lo/hi for a (level, 1-level) interval.

Value

a data.frame with per-time-point WIS and its components, plus the overall mean WIS as an attribute ("mean_wis")

Examples

q <- list("0.025" = matrix(c(2, 8, 15, 25), nrow = 2),
          "0.25"  = matrix(c(4, 6, 18, 22), nrow = 2))
result <- wis(observed = c(5, 20), median_pred = c(5, 21), quantiles = q)
attr(result, "mean_wis")

RtForecastR documentation built on Nov. 25, 2026, 9:09 a.m.