index <- rast(system.file("external/Prob_Map2.rst", package = "TOC"))
boolean <- rast(system.file("external/Change_Map2b.rst", package = "TOC"))
mask <- rast(system.file("external/MASK4.rst", package = "TOC"))
## thresholds can be defined by indicating the number of equal-interval thresholds
rocd <- ROC(index, boolean, mask, nthres = 100)
rocd
## a vector of thresholds can also be used to define the thresholds
thresholds <- seq(min(unique(index)), max(unique(index)) + 1,
by = ceiling(max(unique(index))/10))
rocd <- ROC(index, boolean, mask, thres = thresholds)
rocd
## all the unique values of the index object can be evaluated as thresholds
## (default option)
if (FALSE) {
rocd <- ROC(index, boolean, mask, progress = TRUE)
rocd
}
## generate the ROC curve using non-spatial data (i.e., an object of class numeric)
if (FALSE) {
index <- rast(system.file("external/Prob_Map2.rst", package = "TOC"))
boolean <- rast(system.file("external/Change_Map2b.rst", package = "TOC"))
mask <- rast(system.file("external/MASK4.rst", package = "TOC"))
index <- values(index, mat = FALSE)
boolean <- values(boolean, mat = FALSE)
mask <- values(mask, mat = FALSE)
rocd <- ROC(index, boolean, mask, nthres = 100)
rocd
}
Run the code above in your browser using DataLab