Learn R Programming

scoringutils (version 0.1.7.2)

score_heatmap: Create a Heatmap of a Scoring Metric

Description

This function can be used to create a heatmap of one metric across different groups, e.g. the interval score obtained by several forecasting models in different locations.

Usage

score_heatmap(
  scores,
  y = "model",
  x,
  metric,
  facet_formula = NULL,
  scales = "free_y",
  ncol = NULL,
  facet_wrap_or_grid = "facet_wrap",
  ylab = y,
  xlab = x
)

Arguments

scores

A data.frame of scores based on quantile forecasts as produced by eval_forecasts.

y

The variable from the scores you want to show on the y-Axis. The default for this is "model"

x

The variable from the scores you want to show on the x-Axis. This could be something like "horizon", or "location"

metric

the metric that determines the value and colour shown in the tiles of the heatmap

facet_formula

facetting formula passed down to ggplot. Default is NULL

scales

scales argument that gets passed down to ggplot. Only necessary if you make use of facetting. Default is "free_y"

ncol

Number of columns for facet wrap. Only relevant if facet_formula is given and facet_wrap_or_grid == "facet_wrap"

facet_wrap_or_grid

Use ggplot2's facet_wrap or facet_grid? Anything other than "facet_wrap" will be interpreted as facet_grid. This only takes effect if facet_formula is not NULL

ylab

Label for the y-axis. Default is the variable name on the y-axis

xlab

Label for the x-axis. Default is the variable name on the x-axis

Value

A ggplot2 object showing a heatmap of the desired metric

Examples

Run this code
# NOT RUN {
scores <- scoringutils::eval_forecasts(scoringutils::quantile_example_data,
                                       summarise_by = c("model", "value_desc", "range"))

scoringutils::score_heatmap(scores, x = "value_desc", metric = "bias")

# }

Run the code above in your browser using DataLab