ci | R Documentation |
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.
ci(...)
## S3 method for class 'roc'
ci(roc, of = c("auc", "thresholds", "sp", "se", "coords"), ...)
## S3 method for class 'smooth.roc'
ci(smooth.roc, of = c("auc", "sp", "se", "coords"), ...)
## S3 method for class 'multiclass.roc'
ci(multiclass.roc, of = "auc", ...)
## S3 method for class 'multiclass.auc'
ci(multiclass.auc, of = "auc", ...)
## S3 method for class 'formula'
ci(formula, data, ...)
## Default S3 method:
ci(response, predictor, ...)
roc, smooth.roc |
a “roc” object from the
|
multiclass.roc, multiclass.auc |
not implemented. |
response, predictor |
arguments for the |
formula, data |
a formula (and possibly a data object) of type
response~predictor for the |
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 |
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.
The return value of the specific ci
functions
ci.auc
, ci.thresholds
, ci.sp
, ci.se
or ci.coords
, depending on the
of
argument.
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: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1186/1471-2105-12-77")}.
roc
, auc
, ci.auc
,
ci.thresholds
, ci.sp
, ci.se
, ci.coords
# 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")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.