plot_ranges: Plot Metrics by Range of the Prediction Interval

View source: R/plot.R

plot_rangesR Documentation

Plot Metrics by Range of the Prediction Interval

Description

Visualise the metrics by range, e.g. if you are interested how different interval ranges contribute to the overall interval score, or how sharpness / dispersion changes by range.

Usage

plot_ranges(scores, y = "interval_score", x = "model", colour = "range")

Arguments

scores

A data.frame of scores based on quantile forecasts as produced by score() or summarise_scores(). Note that "range" must be included in the by argument when running summarise_scores()

y

The variable from the scores you want to show on the y-Axis. This could be something like "interval_score" (the default) or "dispersion"

x

The variable from the scores you want to show on the x-Axis. Usually this will be "model"

colour

Character vector of length one used to determine a variable for colouring dots. The Default is "range".

Value

A ggplot2 object showing a contributions from the three components of the weighted interval score

Examples

library(ggplot2)
scores <- score(example_quantile)
scores <- summarise_scores(scores, by = c("model", "target_type", "range"))

plot_ranges(scores, x = "model") +
  facet_wrap(~target_type, scales = "free")

# visualise dispersion instead of interval score
plot_ranges(scores, y = "dispersion", x = "model") +
  facet_wrap(~target_type)

scoringutils documentation built on Aug. 17, 2022, 1:16 a.m.