Skip to contents

Set Up a Calibration Plot Configuration

Usage

setup_CalibrationConfig(
  observed = "observed",
  probability = "probability",
  group = NULL,
  n_bins = 10L,
  bin_method = "quantile",
  na_rm = TRUE,
  mode = "lines+markers",
  show_brier = TRUE,
  rug = TRUE,
  rug_size = 8,
  rug_opacity = 0.3,
  point_size = 7,
  line_width = 2,
  digits = 3L,
  diagonal = TRUE,
  diagonal_color = "#888888",
  palette = NULL,
  legend = TRUE,
  legend_position = "top",
  legend_placement = "outside",
  legend_title = NULL,
  square = TRUE,
  xlab = "Mean predicted probability",
  ylab = "Observed proportion",
  title = NULL,
  dat_path = NULL,
  origin = NULL,
  writer = NULL
)

Arguments

observed

Character: Column containing binary outcomes, zero or one.

probability

Character: Column containing predicted probabilities.

group

Optional Character: Column identifying samples or models.

n_bins

Integer [1, Inf): Requested number of bins per group.

bin_method

Character {"quantile", "equidistant"}: Binning rule.

na_rm

Logical: Remove incomplete observation/probability pairs.

mode

Character {"lines", "markers", "lines+markers"}: Curve display.

show_brier

Logical: Include each sample's Brier score in its legend label.

rug

Logical: Show the distribution of individual probabilities.

rug_size

Numeric (0, Inf): Rug tick height in pixels.

rug_opacity

Numeric [0, 1]: Rug tick opacity.

point_size

Numeric (0, Inf): Calibration marker diameter in pixels.

line_width

Numeric: Curve stroke width in pixels.

digits

Integer: Decimal places for AUC labels and tooltip values.

diagonal

Logical: Show an independent chance diagonal.

diagonal_color

Character: Chance-line color.

palette

Optional Character: Group colors; unset uses the chart theme.

legend

Logical: Show group labels and AUC summaries.

legend_position

Character {"top", "bottom", "left", "right", "top-left", "top-right", "bottom-left", "bottom-right"}: Legend anchor. Top/bottom anchors use horizontal rows; left/right anchors use a vertical column. Corner anchors align within the top or bottom row.

legend_placement

Character {"outside", "inside"}: Relation to the plotting area. Outside placement reserves space for the complete legend; inside placement overlays the data. Neither setting adds a missing legend.

legend_title

Optional Character: Title drawn with the legend or colorbar: above left/right legends and vertical colorbars, before the first row of top/bottom legends and horizontal colorbars. NULL draws no title. A title does not add a missing legend.

square

Logical: Keep the plotting grid square.

xlab

Character: Horizontal axis label.

ylab

Character: Vertical axis label.

title

Optional Character: Chart title.

dat_path

Optional Character: Path to the data, read at draw time. The serializable alternative to passing data to draw().

origin

Optional Named character: Per-property provenance.

writer

Optional Named character: Interface name and version.

Value

A CalibrationConfig object.

Examples

setup_CalibrationConfig(group = "model", n_bins = 5L)
#> <CalibrationConfig>
#> 
#>               type: <chr> calibration
#>           dat_path: <NUL> NULL
#>              title: <NUL> NULL
#>             origin: <chr> default, default, default, default, ...
#>             writer: <NUL> NULL
#>    legend_position: <chr> top
#>   legend_placement: <chr> outside
#>       legend_title: <NUL> NULL
#>           observed: <chr> observed
#>        probability: <chr> probability
#>              group: <chr> model
#>             n_bins: <int> 5
#>         bin_method: <chr> quantile
#>              na_rm: <lgc> TRUE
#>               mode: <chr> lines+markers
#>         show_brier: <lgc> TRUE
#>                rug: <lgc> TRUE
#>           rug_size: <nmr> 8.00
#>        rug_opacity: <nmr> 0.30
#>         point_size: <nmr> 7.00
#>         line_width: <nmr> 2.00
#>             digits: <int> 3
#>           diagonal: <lgc> TRUE
#>     diagonal_color: <chr> #888888
#>            palette: <NUL> NULL
#>             legend: <lgc> TRUE
#>             square: <lgc> TRUE
#>               xlab: <chr> Mean predicted probability
#>               ylab: <chr> Observed proportion
#>