Plot of empirical forecast coverage by reference date.
Source:R/plot_coverage.R
plot_coverage_by_date.Rd
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
or0.5
.- coverage_col
Name of the column corresponding to that coverage level in
scored
. Defaultinterval_coverage_<x>
whereis the coverage level as a percentage, e.g. if coverage_level = 0.95
, then ifcoverage_col
is not specified,plot_coverage_by_date
will look for a column namedinterval_coverage_95
, as this is the default name for interval coverage columns produced byscoringutils::score()
andscoringutils::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 toggplot2::scale_y_continuous()
. Default"identity"
.- y_labels
labeling scheme for the y axis. Passed as the
labels
argument toggplot2::scale_y_continuous()
. Defaultscales::label_percent()
.