Skip to contents

Plot of empirical forecast coverage by reference date.

Usage

plot_coverage_by_date(
  scored,
  coverage_level,
  coverage_col = NULL,
  date_col = "reference_date",
  group_cols = c("target", "horizon"),
  y_transform = "identity",
  y_labels = scales::label_percent()
)

Arguments

scored

Output of scoringutils::score(), not yet summarized, containing a column for coverage at the required coverage level.

coverage_level

Decimal coverage level to plot, e.g. 0.95 or 0.5.

coverage_col

Name of the column corresponding to that coverage level in scored. Default interval_coverage_<x> where is the coverage level as a percentage, e.g. if coverage_level = 0.95, then if coverage_col is not specified, plot_coverage_by_date will look for a column named interval_coverage_95, as this is the default name for interval coverage columns produced by scoringutils::score() and scoringutils::summarise_scores()

date_col

Column containing dates, which will become the x-axis in the empirical coverage by date plot. This can be a target date, but more commonly it will be a forecast date, or reference_date indicating when the forecast was produced. Default "reference_date", the standard name for a forecast date in the hubverse schema.

group_cols

Other columns to group by, in addition to forecast date. These will become facets in the output ggplot. Default c("target", "horizon") (i.e. group by forecasting target and forecast horizon.

y_transform

transform for the y axis, a string. Passed as the transform argument to ggplot2::scale_y_continuous(). Default "identity".

y_labels

labeling scheme for the y axis. Passed as the labels argument to ggplot2::scale_y_continuous(). Default scales::label_percent().

Value

A ggplot of the empirical coverage.