plot {nsROC} | R Documentation |
Plot an ROC curve object
Description
This function plots a 'groc', 'rocbands' or 'cdroc' object.
Usage
## S3 method for class 'groc'
plot(x, lwd = 2, xlab = "False-Positive Rate",
ylab = "True-Positive Rate", main = "ROC curve", ...)
## S3 method for class 'rocbands'
plot(x, type='s', lwd=2, xlim=c(0,1), ylim=c(0,1),
xlab="False-Positive Rate", ylab="True-Positive Rate",
main=paste("ROC curve \n (", obj$method, " confidence bands)", sep=""),
col='aquamarine3', col.inside="azure2", col.frontier="azure3",
lwd.frontier=2, ...)
## S3 method for class 'cdroc'
plot(x, type='s', lwd=3, xlab='1 - Specificity',
ylab='Sensitivity', xaxs='i', yaxs='i',
main=paste("ROC curve at time", obj$predict.time), ...)
Arguments
x |
a 'groc', 'rocbands' or 'cdroc' object from the |
type |
what type of plot should be drawn. |
lwd |
the line width to be used for ROC curve estimate, a positive number. See |
col |
the color to be used for ROC curve estimate. See |
lwd.frontier |
the line width to be used for ROC curve confidence bands estimate. |
col.inside , col.frontier |
the color to be used for ROC curve confidence bands estimate ( |
xlim , ylim |
numeric vectors of length 2, giving the x and y coordinates ranges. See |
xlab , ylab |
a title for the x and y axis, respectively. See |
xaxs , yaxs |
the style of axis interval calculation to be used for the x and y axis, respectively. See |
main |
an overall title for the plot. See |
... |
further arguments to be passed to methods, such as graphical parameters. See |
Value
These functions return a plot of the object they were passed.
Examples
# Data generation
set.seed(123)
X <- c(rnorm(45), rnorm(30,2,1.5))
D <- c(rep(0,45), rep(1,30))
# Plot an ROC curve
grocobj <- gROC(X,D)
plot(grocobj)
# Plot ROC curve confidence bands
rocbandsobj <- ROCbands(grocobj)
plot(rocbandsobj)
# Plot cumulative/dynamic ROC curve
set.seed(123)
stime <- rchisq(50,3)
status <- sample(c(rep(1,40), rep(0,10)))
marker <- max(stime) - stime + rnorm(50,0,2)
cdrocobj <- cdROC(stime, status, marker, 2.8, ci=TRUE)
plot(cdrocobj)