add_coverage: Add coverage of central prediction intervals

View source: R/summarise_scores.R

add_coverageR Documentation

Add coverage of central prediction intervals

Description

Adds a column with the coverage of central prediction intervals to unsummarised scores as produced by score()

Usage

add_coverage(scores, by, ranges = c(50, 90))

Arguments

scores

A data.table of scores as produced by score().

by

character vector with column names to add the coverage for.

ranges

numeric vector of the ranges of the central prediction intervals for which coverage values shall be added.

Details

The coverage values that are added are computed according to the values specified in by. If, for example, by = "model", then there will be one coverage value for every model and add_coverage() will compute the coverage for every model across the values present in all other columns which define the unit of a single forecast.

Value

a data.table with unsummarised scores with columns added for the coverage of the central prediction intervals. While the overall data.table is still unsummarised, note that for the coverage columns some level of summary is present according to the value specified in by.

Examples

library(magrittr) # pipe operator
score(example_quantile) %>%
  add_coverage(by = c("model", "target_type")) %>%
  summarise_scores(by = c("model", "target_type")) %>%
  summarise_scores(fun = signif, digits = 2)

scoringutils documentation built on Feb. 16, 2023, 7:30 p.m.