cal_plot_multi: Generate multiple calibration plots with colored/shaded 95...

View source: R/cal_plots.R

cal_plot_multiR Documentation

Generate multiple calibration plots with colored/shaded 95 percent confidence intervals

Description

This code builds off of code written by Darren Dahly, PhD in this blog post: https://darrendahly.github.io/post/homr/.

Usage

cal_plot_multi(
  df,
  outcome,
  prediction,
  model,
  n_bins = 10,
  show_loess = FALSE,
  plot_title = "",
  ...
)

Arguments

df

The df as a data.frame.

outcome

A character string containing the name of the column containing the outcomes (expressed as 0/1s).

prediction

A character string containing the name of the column containing the predictions.

model

A character string containing the name of the column containing the model names

n_bins

Number of bins. Defaults to 10. Set to 0 to hide binned calibration.

show_loess

Whether to show loess smoothed calibration estimates. Defaults to FALSE. For cal_plot(), you can display both a binned calibration plot and a loess curve. In contrast, for cal_plot_multi(), these options are mutually exclusive. To display a loess line, you must set n_bins to 0.

plot_title

A character string containing the title for the resulting plot.

Value

A ggplot containing the calibration plot

Examples

data(multi_model_dataset)
cal_plot_multi(multi_model_dataset, outcome = 'outcomes',model = 'model_name', prediction = 'predictions', n_bins = 5)

ML4LHS/runway documentation built on Sept. 9, 2023, 8:27 p.m.