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",
  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.

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)
#> <rtemis.draw::CalibrationConfig>
#>  @ type            : chr "calibration"
#>  @ dat_path        : NULL
#>  @ title           : NULL
#>  @ origin          : Named chr [1:25] "default" "default" "default" "default" "default" ...
#>  .. - attr(*, "names")= chr [1:25] "dat_path" "title" "legend_position" "legend_placement" ...
#>  @ writer          : NULL
#>  @ legend_position : chr "top"
#>  @ legend_placement: chr "outside"
#>  @ observed        : chr "observed"
#>  @ probability     : chr "probability"
#>  @ group           : chr "model"
#>  @ n_bins          : int 5
#>  @ bin_method      : chr "quantile"
#>  @ na_rm           : logi TRUE
#>  @ mode            : chr "lines+markers"
#>  @ show_brier      : logi TRUE
#>  @ rug             : logi TRUE
#>  @ rug_size        : num 8
#>  @ rug_opacity     : num 0.3
#>  @ point_size      : num 7
#>  @ line_width      : num 2
#>  @ digits          : int 3
#>  @ diagonal        : logi TRUE
#>  @ diagonal_color  : chr "#888888"
#>  @ palette         : NULL
#>  @ legend          : logi TRUE
#>  @ square          : logi TRUE
#>  @ xlab            : chr "Mean predicted probability"
#>  @ ylab            : chr "Observed proportion"