ci.se | R Documentation |
This function computes the confidence interval (CI) of the sensitivity at the given specificity points. By default, the 95% CI are computed with 2000 stratified bootstrap replicates.
# ci.se(...)
## S3 method for class 'roc'
ci.se(roc, specificities = 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.se(smooth.roc, specificities = 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.se(formula, data, ...)
## Default S3 method:
ci.se(response, predictor, ...)
roc, smooth.roc |
a “roc” object from the
|
response, predictor |
arguments for the |
formula, data |
a formula (and possibly a data object) of type
response~predictor for the |
specificities |
on which specificities to evaluate the CI. |
conf.level |
the width of the confidence interval as [0,1], never in percent. Default: 0.95, resulting in a 95% CI. |
boot.n |
the number of bootstrap replicates. Default: 2000. |
boot.stratified |
should the bootstrap be stratified (default, same number of cases/controls in each replicate than in the original sample) or not. |
progress |
the name of progress bar to display. Typically
“none”, “win”, “tk” or “text” (see the
|
parallel |
if TRUE, the bootstrap is processed in parallel, using parallel backend provided by plyr (foreach). |
... |
further arguments passed to or from other methods,
especially arguments for |
ci.se.formula
and ci.se.default
are convenience methods
that build the ROC curve (with the roc
function) before
calling ci.se.roc
. You can pass them arguments for both
roc
and ci.se.roc
. Simply use ci.se
that will dispatch to the correct method.
The ci.se.roc
function creates boot.n
bootstrap replicate of the ROC
curve, and evaluates the sensitivity at specificities
given by the specificities
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.
A matrix of class “ci.se”, “ci” and “matrix” (in this order) containing the given sensitivities. Row (names) are the specificities, the first column the lower bound, the 2nd column the median and the 3rd column the upper bound.
Additionally, the list has the following attributes:
conf.level |
the width of the CI, in fraction. |
boot.n |
the number of bootstrap replicates. |
boot.stratified |
whether or not the bootstrapping was stratified. |
specificities |
the specificities as given in argument. |
roc |
the object of class “roc” that was used to compute the CI. |
If 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 “NA value(s) produced during bootstrap were ignored.”
will be issued and the observation will be ignored. If you have a large
imbalance in your sample, it could be safer to keep
boot.stratified=TRUE
.
If density.cases
and density.controls
were provided
for smoothing, the error “Cannot compute the statistic on ROC
curves smoothed with density.controls and density.cases.” is issued.
James Carpenter and John Bithell (2000) “Bootstrap condence intervals: when, which, what? A practical guide for medical statisticians”. Statistics in Medicine 19, 1141–1164. DOI: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/(SICI)1097-0258(20000515)19:9<1141::AID-SIM479>3.0.CO;2-F")}.
Tom Fawcett (2006) “An introduction to ROC analysis”. Pattern Recognition Letters 27, 861–874. DOI: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.patrec.2005.10.010")}.
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")}.
Hadley Wickham (2011) “The Split-Apply-Combine Strategy for Data Analysis”. Journal of Statistical Software, 40, 1–29. URL: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v040.i01")}.
roc
,
ci
,
ci.sp
,
plot.ci
# Create a ROC curve:
data(aSAH)
roc1 <- roc(aSAH$outcome, aSAH$s100b)
## Basic example ##
## Not run:
ci.se(roc1)
## End(Not run)
## More options ##
# Customized bootstrap and specificities:
## Not run:
ci.se(roc1, c(.95, .9, .85), boot.n=10000, conf.level=0.9, stratified=FALSE)
## End(Not run)
## Plotting the CI ##
ci1 <- ci.se(roc1, boot.n = 10)
plot(roc1)
plot(ci1)
## On smoothed ROC curves with bootstrap ##
## Not run:
ci.se(smooth(roc1, method="density"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.