I have this ROC plot:
library(Epi)
library(pROC)
data(aSAH)
data <- aSAH
plot.roc(data$outcome, data$s100b)
I want to color the Area under the curve: 0.7314
.
I tried variations on...
x <- seq(1, 0, by = - .001)
polygon(x, roc(data$outcome, data$s100b),
col = rgb(.35,0.31,0.61, alpha = 0.4),
border = rgb(.35,0.31,0.61, 0.4),
lwd=2)
... and get the error message: Error in xy.coords(x, y) : 'x' and 'y' lengths differ
.
How can I make the lengths work out?
The
plot.roc
function frompROC
has built parameters to enable (auc.polygon
) and tune (auc.polygon.col
,auc.polygon.border
, etc., see?plot.roc
) the display of the AUC. In your case you could use:Try