# ci.sp(...)
## S3 method for class 'roc':
ci.sp(roc, sensitivities = seq(0, 1, .1) * ifelse(roc$percent,
100, 1), conf.level=0.95, boot.n=2000, boot.stratified=TRUE,
progress=getOption("pROCProgress")$name, parallel=FALSE, ...)
## S3 method for class 'smooth.roc':
ci.sp(smooth.roc, sensitivities = seq(0, 1, .1) *
ifelse(smooth.roc$percent, 100, 1), conf.level=0.95, boot.n=2000,
boot.stratified=TRUE, progress=getOption("pROCProgress")$name, parallel=FALSE, ...)
## S3 method for class 'formula':
ci.sp(formula, data, ...)
## S3 method for class 'default':
ci.sp(response, predictor, ...)roc function, or a smooth.roc function.roc function.roc function.name argument to create_progress_broc and ci.sp.roc
when calling ci.sp.default or ci.sp.formula.
Arguments for Additionally, the list has the following attributes:
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 ci.sp.formula and ci.sp.default are convenience methods
that build the ROC curve (with the roc function) before
calling ci.sp.roc. You can pass them arguments for both
roc and ci.sp.roc. Simply use ci.sp
that will dispatch to the correct method.
The ci.sp.roc function creates boot.n bootstrap replicate of the ROC
curve, and evaluates the specificity at sensitivities
given by the sensitivities argument. Then it computes the
confidence interval as the percentiles given by conf.level.For more details about the bootstrap, see the Bootstrap section in this package's documentation.
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.
Tom Fawcett (2006) ``An introduction to ROC analysis''. Pattern
Recognition Letters 27, 861--874. DOI:
roc,
ci,
ci.se,
plot.ci
CRAN package data(aSAH)
# Syntax (response, predictor):
ci.sp(aSAH$outcome, aSAH$s100b)
# With a roc object:
rocobj <- roc(aSAH$outcome, aSAH$s100b)
ci.sp(rocobj)
# Customized bootstrap and specific specificities:
ci.sp(rocobj, c(.95, .9, .85), boot.n=500, conf.level=0.9, stratified=FALSE)
# Alternatively, you can get the CI directly from roc():
rocobj <- roc(aSAH$outcome,
aSAH$s100b, ci=TRUE, of="sp", boot.n=100)
rocobj$ci
# Plotting the CI
plot(rocobj)
plot(rocobj$ci)
# On a smoothed ROC, the CI is re-computed automatically
smooth(rocobj)
# Or you can compute a new one:
ci.sp(smooth(rocobj, method="density", reuse.ci=FALSE), boot.n=100)Run the code above in your browser using DataLab