pROC (version 1.16.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 roc
ci(roc, of = c("auc", "thresholds", "sp", "se", "coords"), ...)
# S3 method for smooth.roc
ci(smooth.roc, of = c("auc", "sp", "se", "coords"), ...)
# S3 method for multiclass.roc
ci(multiclass.roc, of = "auc", ...)
# S3 method for multiclass.auc
ci(multiclass.auc, of = "auc", ...)
# S3 method for formula
ci(formula, data, ...)
# S3 method for default
ci(response, predictor, ...)

Arguments

roc, smooth.roc

a “roc” object from the roc function, or a “smooth.roc” object from the smooth function.

multiclass.roc, multiclass.auc

not implemented.

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”, “se” or “coords”. 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, ci.se, ci.sp and ci.thresholds.

Value

The return value of the specific ci functions ci.auc, ci.thresholds, ci.sp, ci.se or ci.coords, depending on the of argument.

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, ci.se or ci.coords are called.

When the ROC curve has an auc of 1 (or 100%), the confidence interval will always be null (there is no interval). This is true for both “delong” and “bootstrap” methods that can not properly assess the variance in this case. This result is misleading, as the variance is of course not null. A warning will be displayed to inform of this condition, and of the misleading output.

CI of multiclass ROC curves and AUC is not implemented yet. Attempting to call these methods returns an error.

References

Xavier Robin, Natacha Turck, Alexandre Hainard, et al. (2011) ``pROC: an open-source package for R and S+ to analyze and compare ROC curves''. BMC Bioinformatics, 7, 77. DOI: 10.1186/1471-2105-12-77.

See Also

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

Examples

Run this code
# NOT RUN {
# Create a ROC curve:
data(aSAH)
roc1 <- roc(aSAH$outcome, aSAH$s100b)


## AUC ## 
ci(roc1)
# this is equivalent to:
ci(roc1, of = "auc")
# or:
ci.auc(roc1)


## Coordinates ##
# }
# NOT RUN {
# Thresholds
ci(roc1, of = "thresholds")
ci(roc1, of = "thresholds", thresholds = "all")
ci(roc1, of = "thresholds", thresholds = 0.51)
# equivalent to:
ci.thresholds(roc1, thresholds = 0.51)

# SE/SP
ci(roc1, of = "sp", sensitivities = c(.95, .9, .85))
ci.sp(roc1)
ci(roc1, of = "se")
ci.se(roc1)

# Arbitrary coordinates
ci(roc1, of = "coords", "best")
ci.coords(roc1, 0.51, "threshold")
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace