Learn R Programming

pROC (version 1.8)

plot.ci: Plot confidence intervals

Description

This function adds confidence intervals to a ROC curve plot, either as bars or as a confidence shape.

Usage

"plot"(x, length=.01*ifelse(attr(x, "roc")$percent, 100, 1), col=par("fg"), ...) "plot"(x, type=c("bars", "shape"), length=.01*ifelse(attr(x, "roc")$percent, 100, 1), col=ifelse(type=="bars", par("fg"), "gainsboro"), no.roc=FALSE, ...) "plot"(x, type=c("bars", "shape"), length=.01*ifelse(attr(x, "roc")$percent, 100, 1), col=ifelse(type=="bars", par("fg"), "gainsboro"), no.roc=FALSE, ...)

Arguments

x
a confidence interval object from the functions ci.thresholds, ci.se or ci.sp.
type
type of plot, “bars” or “shape”. Can be shortened to “b” or “s”. “shape” is only available for ci.se and ci.sp, not for ci.thresholds.
length
the length (as plot coordinates) of the bar ticks. Only if type="bars".
no.roc
if FALSE, the ROC line is re-added over the shape. Otherwise if TRUE, only the shape is plotted. Ignored if type="bars"
col
color of the bars or shape.
...
further arguments for segments (if type="bars") or polygon (if type="shape").

Value

This function returns the confidence interval object invisibly.

Warnings

With type="shape", the warning “Low definition shape” is issued when the shape is defined by less than 15 confidence intervals. In such a case, the shape is not well defined and the ROC curve could pass outside the shape. To get a better shape, increase the number of intervals, for example with:
plot(ci.sp(rocobj, sensitivities=seq(0, 1, .01)), type="shape")

Details

This function adds confidence intervals to a ROC curve plot, either as bars or as a confidence shape, depending on the state of the type argument. The shape is plotted over the ROC curve, so that the curve is re-plotted unless no.roc=TRUE. Graphical functions are called with suppressWarnings.

References

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: 10.1186/1471-2105-12-77.

See Also

plot.roc, ci.thresholds, ci.sp, ci.se

Examples

Run this code
data(aSAH)
## Not run: 
# # Start a ROC plot
# rocobj <- plot.roc(aSAH$outcome, aSAH$s100b)
# plot(rocobj)
# # Thresholds
# ci.thresolds.obj <- ci.thresholds(rocobj)
# plot(ci.thresolds.obj)
# # Specificities
# plot(rocobj) # restart a new plot
# ci.sp.obj <- ci.sp(rocobj, boot.n=500)
# plot(ci.sp.obj)
# # Sensitivities
# plot(rocobj) # restart a new plot
# ci.se.obj <- ci(rocobj, of="se", boot.n=500)
# plot(ci.se.obj)
# 
# # Plotting a shape. We need more
# ci.sp.obj <- ci.sp(rocobj, sensitivities=seq(0, 1, .01), boot.n=100)
# plot(rocobj) # restart a new plot
# plot(ci.sp.obj, type="shape", col="blue")
# 
# # Direct syntax (response, predictor):
# plot.roc(aSAH$outcome, aSAH$s100b,
#          ci=TRUE, of="thresholds")
# ## End(Not run)

Run the code above in your browser using DataLab