Last chance! 50% off unlimited learning
Sale ends in
ci.auc(...)
## S3 method for class 'roc':
ci.auc(roc, conf.level=0.95, boot.n=2000,
boot.stratified=TRUE, reuse.auc=TRUE,
progress=getOption("pROCProgress")$name, ...)
## S3 method for class 'smooth.roc':
ci.auc(smooth.roc, conf.level=0.95, boot.n=2000,
boot.stratified=TRUE, reuse.auc=TRUE,
progress=getOption("pROCProgress")$name, ...)
## S3 method for class 'auc':
ci.auc(auc, ...)
## S3 method for class 'formula':
ci.auc(formula, data, ...)
## S3 method for class 'default':
ci.auc(response, predictor, ...)
roc
function, or a smooth.roc
function.auc
function.roc
function.roc
function.TRUE
(default) and the ...
arguments to
auc
name
argument to
roc
and roc.test.roc
when calling roc.test.default
or roc.test.formula
.
Arguments freuse.auc
is set toTRUE
(default). It is naturally
inherited from any call toroc
and fits most cases.auc
with...(argumentspartial.auc
,partial.auc.correct
andpartial.auc.focus
). In this case, you must ensure either that
theroc
object do not contain anauc
field (if
you calledroc
withauc=FALSE
), or setreuse.auc=FALSE
. If reuse.auc=FALSE
the auc
function will always
be called with ...
to determine the specification, even if
the auc
field.
As well if the auc
field, the auc
function will always be called with
...
to determine the specification.
Warning: if the roc object passed to ci contains an auc
field and reuse.auc=TRUE
, auc is not called and
arguments such as partial.auc
are silently ignored.
boot.stratified=FALSE
and the sample has a large imbalance between
cases and controls, it could happen that one or more of the replicates
contains no case or control observation, or that there are not enough
points for smoothing, producing a NA
area.
The warning boot.stratified=TRUE
.density.cases
and density.controls
were provided
for smoothing, the error auc
boot.n
times with the parameters defined
in roc
function is called to build the ROC curve first. The confidence interval is computed by bootstrap, according to the
method described by Carpenter and Bithell (2000). boot.n
bootstrap
replicates are drawn. Stratification of bootstrap can be controlled
with boot.stratified
. In stratified bootstrap, each replicate
contains the same number of cases and controls than the original
sample. Stratification is especially useful if one group has only
little observations, or if groups are not balanced.
Higher numbers of boot.n
will give a more precise estimate of the CI,
but take more time to compute. 2000 is recommanded by Carpenter and
Bithell.
For smoothed ROC curves, smoothing is performed again at each
bootstrap replicate with the parameters originally provided.
If a density smoothing was performed with user-provided
density.cases
or density.controls
the bootstrap cannot
be performed and an error is issued.
roc
, auc
, ci
data(aSAH)
# Syntax (response, predictor):
ci.auc(aSAH$outcome, aSAH$s100b)
# With a roc object:
rocobj <- roc(aSAH$outcome, aSAH$s100b)
# default values
ci.auc(rocobj)
ci(rocobj)
ci(auc(rocobj))
ci(rocobj$auc)
# Partial AUC and customized bootstrap:
ci.auc(aSAH$outcome, aSAH$s100b,
boot.n=500, conf.level=0.9, stratified=FALSE, partial.auc=c(1, .8),
partial.auc.focus="se", partial.auc.correct=TRUE)
# Note that the following will NOT give a CI of the partial AUC:
ci.auc(rocobj, boot.n=500, conf.level=0.9, stratified=FALSE,
partial.auc=c(1, .8), partial.auc.focus="se", partial.auc.correct=TRUE)
# This is because rocobj$auc is not a partial AUC.
# You can overcome this problem with reuse.auc:
ci.auc(rocobj, boot.n=500, conf.level=0.9, stratified=FALSE,
partial.auc=c(1, .8), partial.auc.focus="se", partial.auc.correct=TRUE,
reuse.auc=TRUE)
# Alternatively, you can get the CI directly from roc():
rocobj <- roc(aSAH$outcome,
aSAH$s100b, ci=TRUE, of="auc", boot.n=100)
rocobj$ci
# Get a specific resampled AUC:
attr(rocobj$ci, "aucs")[42]
# On a smoothed ROC, the CI is re-computed automatically
smooth(rocobj)
# Or you can compute a new one:
ci.auc(smooth(rocobj, method="density", reuse.ci=FALSE), boot.n=100)
Run the code above in your browser using DataLab