Learn R Programming

pROC (version 1.3.1)

ci: Compute the confidence interval of a ROC curve

Description

This function computes the confidence interval (CI) of a ROC curve. The of argument controls the type of CI that will be computed. By default, the 95% CI are computed with 2000 stratified bootstrap replicates.

Usage

ci(...)
## S3 method for class 'roc':
ci(roc, of = c("auc", "thresholds", "sp", "se"), ...)
## S3 method for class 'smooth.roc':
ci(smooth.roc, of = c("auc", "sp", "se"), ...)
## S3 method for class 'formula':
ci(formula, data, ...)
## S3 method for class 'default':
ci(response, predictor, ...)

Arguments

roc, smooth.roc
a roc object from the roc function, or a smooth.roc object from the smooth.roc function.
response, predictor
arguments for the roc function.
formula, data
a formula (and possibly a data object) of type response~predictor for the roc function.
of
The type of confidence interval. One of auc, thresholds, sp or se. Note that confidence interval on thresholds are not available for smoothed ROC curves.
...
further arguments passed to or from other methods, especially auc, roc, and the specific ci functions ci.auc

Value

encoding

UTF-8

Details

ci.formula and ci.default are convenience methods that build the ROC curve (with the roc function) before calling ci.roc. You can pass them arguments for both roc and ci.roc. Simply use ci that will dispatch to the correct method. This function is typically called from roc when ci=TRUE (not by default). Depending on the of argument, the specific ci functions ci.auc, ci.thresholds, ci.sp or ci.se are called.

See Also

roc, auc, ci.auc, ci.thresholds, ci.sp, ci.se

Examples

Run this code
data(aSAH)

# Syntax (response, predictor):
ci(aSAH$outcome, aSAH$s100b)

# With a roc object:
rocobj <- roc(aSAH$outcome, aSAH$s100b)

# Of an AUC 
ci(rocobj)
ci(rocobj, of="auc")
# this is strictly equivalent to:
ci.auc(rocobj)

# Of thresholds, sp, se...
ci(rocobj, of="thresholds")
ci(rocobj, of="thresholds", thresholds=0.51)
ci(rocobj, of="thresholds", thresholds="all")
ci(rocobj, of="sp", sensitivities=c(.95, .9, .85))
ci(rocobj, of="se")

# Alternatively, you can get the CI directly from roc():
rocobj <- roc(aSAH$outcome, aSAH$s100b, ci=TRUE, of="auc")
rocobj$ci

Run the code above in your browser using DataLab