auc_ci: AUC with a confidence interval.

View source: R/roc_proc.R

auc_ciR Documentation

AUC with a confidence interval.

Description

Computes AUC together with a confidence interval, using pROC::ci.auc() as the backend (DeLong by default, or bootstrap).

Usage

auc_ci(
  truth,
  prob,
  positive = NULL,
  conf_level = 0.95,
  method = c("delong", "bootstrap"),
  boot_n = 2000L,
  digits = 4L
)

Arguments

truth

Factor (or coercible to factor) of true class labels.

prob

Predicted probability of the positive class, or a probability matrix/data frame with one column per class level.

positive

Optional positive class level. Defaults to the second factor level.

conf_level

Confidence level.

method

"delong" (default, analytic) or "bootstrap".

boot_n

Number of bootstrap replicates when method = "bootstrap".

digits

Number of digits numeric columns are rounded to.

Value

A one-row data frame with auc, conf_low, conf_high, conf_level, and method.

Examples

if (requireNamespace("pROC", quietly = TRUE)) {
  set.seed(1)
  truth <- factor(rbinom(100, 1, 0.4))
  prob <- runif(100)
  auc_ci(truth, prob)
}

funcml documentation built on Aug. 22, 2026, 5:08 p.m.