Accepts reference labels and predicted probabilities, matching lists of those
inputs, or a long table with fpr, tpr, and optional auc, class, split,
fold, and omitted columns. Named input lists are matched by name.
Usage
draw_roc(
true_labels,
predicted_prob = NULL,
positive = NULL,
...,
legend_position = "top",
legend_placement = "outside",
theme = NULL,
width = NULL,
height = NULL,
element_id = NULL,
filename = NULL
)Arguments
- true_labels
Factor, vector, list, or data frame: Reference labels or ROC records.
- predicted_prob
Optional Numeric vector, matrix, or list: Class probabilities.
- positive
Optional Character: Positive class for binary input.
- ...
Additional named settings for
setup_ROCConfig().- 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.
- theme
Optional Theme: Chart theme.
- width, height
Optional Numeric or Character: Widget dimensions.
- element_id
Optional Character: HTML element identifier.
- filename
Optional Character: Static output path, currently SVG.
Details
Binary input uses the second factor level (second level after factor conversion for
nonfactors), unless positive names the desired class. An unnamed probability
vector/column describes that class. Named columns identify their classes;
multiclass matrices use names, or factor-level order when unnamed.
Multiclass curves are one-versus-rest. Missing labels/scores are excluded
separately for each curve and disclosed. Scores must be probabilities in
[0, 1]; direction is fixed, and tied scores enter together. No observations
are deduplicated, curves smoothed, or vertices downsampled.
Legend placement
The shared top/outside layout reserves a horizontal band above the plot. Choose an inside corner to overlay the legend on the data.
Statistical semantics
Vertices are ordered by FPR then TPR and joined without smoothing. Curves
must be monotone and include (0, 0) and (1, 1). Supplied AUC is authoritative
and may describe a higher-resolution curve. Without an AUC binding, the
supplied vertices define trapezoidal AUC. An undefined curve is represented
by missing FPR, TPR, and AUC and is reported in the console when omitted.
Per-resample legends report the unweighted mean and sample SD of defined
fold AUCs, with available/total curve counts. SD is NA for one defined fold.
Pooled AUC is never inferred from per-fold AUCs.
The legend uses the shared position and placement controls. Curve identity
and AUC share a line; long labels wrap to the available width. All entries
remain present in static SVG output, without a scrolling legend.
Hover describes the selected curve, including its resample identifier.
Numeric tooltip labels use digits; coordinates and AUCs retain their full
precision in the compiled data.