Compute the confidence interval of arbitrary coordinates
ci.coords.RdThis function computes the confidence interval (CI) of the coordinates
of a ROC curves with the coords function.
Usage
# ci.coords(...)
# S3 method for class 'roc'
ci.coords(roc, x,
input="threshold",
ret=c("threshold", "specificity", "sensitivity"),
best.method=c("youden", "closest.topleft"), best.weights=c(1, 0.5),
best.policy = c("stop", "omit", "random"),
conf.level=0.95, boot.n=2000,
boot.stratified=TRUE,
progress = NULL, ...)
# S3 method for class 'formula'
ci.coords(formula, data, ...)
# S3 method for class 'smooth.roc'
ci.coords(smooth.roc, x,
input=c("specificity", "sensitivity"), ret=c("specificity", "sensitivity"),
best.method=c("youden", "closest.topleft"), best.weights=c(1, 0.5),
best.policy = c("stop", "omit", "random"),
conf.level=0.95, boot.n=2000,
boot.stratified=TRUE,
progress = NULL, ...)
# Default S3 method
ci.coords(response, predictor, ...)Arguments
- roc, smooth.roc
a “roc” object from the
rocfunction, or a “smooth.roc” object from thesmoothfunction.- response, predictor
arguments for the
rocfunction.- formula, data
a formula (and possibly a data object) of type response~predictor for the
rocfunction.- x, input, ret, best.method, best.weights
Arguments passed to
coords. See there for more details. The only difference is on thexargument which cannot be “all” or “local maximas”.- best.policy
The policy follow when multiple “best” thresholds are returned by
coords. “stop” will abort the processing withstop(default), “omit” will ignore the sample (as inNA) and “random” will select one of the threshold randomly.- 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
DEPRECATED. A value other than
NULLwill produce a warning. The argument will be removed in a future version.- ...
further arguments passed to or from other methods, especially arguments for
rocandci.coords.rocwhen callingci.coords.defaultorci.coords.formula. Arguments fortxtProgressBar(onlycharandstyle) if applicable.
Details
ci.coords.formula and ci.coords.default are convenience methods
that build the ROC curve (with the roc function) before
calling ci.coords.roc. You can pass them arguments for both
roc and ci.coords.roc. Simply use ci.coords
that will dispatch to the correct method.
This function creates boot.n bootstrap replicate of the ROC
curve, and evaluates the coordinates specified by the x, input,
ret, best.method and best.weights arguments. Then it computes the
confidence interval as the percentiles given by conf.level.
When x="best", the best threshold is determined at each bootstrap
iteration, effectively assessing the confidence interval of choice of the "best"
threshold itself. This differs from the behavior of ci.thresholds,
where the "best" threshold is assessed on the given ROC curve before
resampling.
For more details about the bootstrap, see the Bootstrap section in this package's documentation.
Warnings
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, 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.
This warning will also be displayed if you chose best.policy = "omit"
and a ROC curve with multiple “best” threshold was generated
during at least one of the replicates.
Value
Note: changed in version 1.16.
A list of the same length as ret and named as ret, and of
class “ci.thresholds”, “ci” and “list” (in this order).
Each element of the list is a matrix of the confidence intervals with
rows given by x and with 3 columns, the lower bound of the CI,
the median, and the upper bound of the CI.
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.
- input
the input coordinate, as given in argument.
- x
the coordinates used to calculate the CI, as given in argument.
- ret
the return values, as given in argument or substituted by
link{coords}.- roc
the object of class “roc” that was used to compute the CI.
References
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: 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: doi:10.1016/j.patrec.2005.10.010 .
Hadley Wickham (2011) “The Split-Apply-Combine Strategy for Data Analysis”. Journal of Statistical Software, 40, 1–29. URL: doi:10.18637/jss.v040.i01 .