I am traing a 10 fold crossvalidated random forest in R. I have provided the list of roc objects is [here for download][https://drive.google.com/drive/folders/1ZYs1gMzPr64lV7WQmVOu1zt0YSVak9cr] , it is the 'my_roclist.rds' file. The code to make the plot at the bottom is here:
library(pROC)
library(ggplot2)
# load the my_roclist.rds file I've provided in the google drive
hochgerner.roc.list <- loadRDS("my_roclist.rds")
# plotting
jpeg('hochgerner2018_earlysig_roc.jpeg', width = 600, height=600)
ggroc(hochgerner.roc.list, alpha = 1,
colour = "red", linetype = 'solid',
size = 4, legacy.axes = TRUE) +
theme_classic() +
ggtitle("Hochgerner et al., (2018) ROC") +
xlab("FPR") + ylab("TPR") +
geom_segment(aes(x = 0, xend = 1, y = 0, yend = 1), linewidth = 2,
color="darkgrey", linetype="dashed") +
theme(plot.title = element_text(size = 20, face = "bold",
hjust = 0.5),
axis.text=element_text(size=20, face = "bold", colour="black"),
axis.title =element_text(size=20, face = "bold",
colour="black"),
panel.border = element_rect(color = "black",
fill = NA,
linewidth = 2),
plot.margin = margin(t = 10, r = 10, b = 10, l = 10) ) +
scale_x_continuous(expand = expansion(mult = c(0, 0)),
breaks = c(0,0.25,0.5,0.75,1)) +
scale_y_continuous(expand = expansion(mult = c(0, 0)),
breaks = c(0.25,0.5,0.75,1))
dev.off()
I am using the [pROC package][https://cran.r-project.org/web/packages/pROC/pROC.pdf] to generate plots from a random forest model with cross validation. Each fold is executed inside a for loop and an ROC for that curve computed then added to a list of ROC objects. At the end of the training the forests are combined. I plot the fold specific ROCs with [ggroc][https://www.rdocumentation.org/packages/pROC/versions/1.18.4/topics/ggroc.roc] by providing it a list of the roc objects. ggroc() should then plot a curve for each fold's roc, tutorial here. This issue appears to be specific to the data I am feeding it so I cannot reproduce the plot. Why is the ROC non-monotonic? That should be impossible, and the code I am using to produce the model is very straight forward. What could I be doing wrong?
Authors of the pROC package answered the question on their github, and have provided a fix. The issue is here: https://github.com/xrobin/pROC/issues/121