triptych {triptych} | R Documentation |
Evaluation of forecasts using a Triptych
Description
A triptych visualizes three important aspects of predictive performance:
Economic utility via Murphy curves, miscalibration via reliability curves,
and discrimination ability via ROC curves.
The triptych
S3 class has plotting methods for ggplot2
.
Usage
triptych(x, y_var = "y", ..., y = NULL)
Arguments
x |
A data frame, list, matrix, or other object that can be coerced to a tibble. Contains numeric forecasts, and observations (optional). |
y_var |
A variable in |
... |
Additional arguments passed to |
y |
A numeric vector of observations. If supplied, overrides |
Value
A triptych
object, that is a tibble subclass, and contains five columns:
-
forecast
: Contains the names. -
murphy
: Contains avctrs_vctr
subclass of Murphy curves. -
reliability
: Contains avctrs_vctr
subclass of reliability curves. -
roc
: Contains avctrs_vctr
subclass of ROC curves. -
mcbdsc
: Contains avctrs_vctr
subclass of score decompositions.
See Also
Vector class constructors: murphy()
, reliability()
, roc()
, mcbdsc()
Adding uncertainty quantification: add_consistency()
, add_confidence()
Visualization: plot.triptych()
, autoplot.triptych()
Examples
data(ex_binary, package = "triptych")
tr <- triptych(ex_binary)
identical(tr, triptych(ex_binary, y))
identical(tr, triptych(ex_binary, 1))
tr
# 1. Choose 4 predictions
# 2. Add consistency bands (for reliability curves)
# (Bootstrap resampling is expensive, the number of bootstrap samples
# is small to keep execution times short)
# 3. Create patchwork object
# 4. Adjust the title of the legend
dplyr::slice(tr, 1, 3, 6, 9) |>
add_consistency(level = 0.9, method = "resampling_Bernoulli", n_boot = 20) |>
autoplot() &
ggplot2::guides(colour = ggplot2::guide_legend("Forecast"))