Creates reliability diagrams from a data table containing tercile forecasts
It wraps rel_diag_vec
, see ?rel_diag_vec
for more details.
about the output diagrams. The output format is very much inspired by Figure 5 of Mason&2018. By default, 4 diagrams are drawn,
one for each the prediction of above-, normal- and below-values, plus one for all forecasts together.
You can provide a 'by' argument to obtain separate reliability diagrams for different values of the by-columns. E.g., when you data table contains
a column named 'season', you can set by = 'season'. Then, the function will output a list of 16 diagrams, 4 for each season.
rel_diag(
dt,
f = c("below", "normal", "above"),
o = tc_cols(dt),
by = NULL,
pool = setdiff(dimvars(dt), by),
binwidth = 0.05,
dim.check = TRUE
)
A list of gg objects which can be plotted by ggpubr::ggarrange (for example)
Data table containing tercile forecasts
column names of the prediction columns
column name of the observation column
column names of grouping variables. Default is to not group.
column names of pooling variables (used for the dimension check). Default is all dimvars.
bin width for discretizing probabilities.
Logical. If TRUE, the function checks whether the columns in by and pool span the entire data table.
# \donttest{
dt = data.table(below = c(0.5,0.3,0),
normal = c(0.3,0.3,0.7),
above = c(0.2,0.4,0.3),
tc_cat = c(-1,0,0),
lon = 1:3)
print(dt)
pp = rel_diag(dt)
if(interactive()) plot(pp)
# }
Run the code above in your browser using DataLab