ROC {TOC}R Documentation

Construct the table for the ROC curve

Description

Construct the table for the Relative Operating Characteristic (ROC) curve for spatial or non-spatial data

Usage

## S4 method for signature 'numeric,numeric'
ROC(index, boolean, mask = NULL, nthres = NULL, thres = NULL, 
NAval = 0, progress = FALSE)

## S4 method for signature 'SpatRaster,SpatRaster'
ROC(index, boolean, mask = NULL, nthres = NULL, thres = NULL, 
NAval = 0, progress = FALSE)

Arguments

index

index object of class numeric or SpatRaster

boolean

boolean object of class numeric or SpatRaster

mask

mask object of class numeric or SpatRaster

nthres

an optional integer indicating the number of equal-interval thresholds to be evaluated for the ROC curve. See Details below

thres

an optional numeric vector of thresholds to be evaluated for the ROC curve. See Details below

NAval

value for nodata (NA values) in the mask object

progress

logical; if TRUE, a progress bar is shown

Details

thresholds are calculated as the unique values of the index object after masking out NA values (default option), if neither nthres nor thres is provided. The default option can be time-consuming if the amount of unique values in the index object (after masking out NA values) is large (e.g., greater than 1000). In the latter case, the user may prefer to enter specified thresholds (with the thres argument), or to indicate the number of equal-interval thresholds to be evaluated for the ROC curve (with the nthres argument)

Value

an object of class Roc containing the ROC table, the area under the curve (AUC), maximum AUC and minimum AUC

References

Pontius Jr., R.G., Kangpin, Si. 2014. The total operating characteristic to measure diagnostic ability for multiple thresholds. International Journal of Geographical Information Science 28 (3): 570-583. <doi:10.1080/13658816.2013.862623>

Pontius, G., Parmentier, B. 2014. Recommendations for using the Relative Operating Characteristic (ROC). Landscape Ecology 29 (3): 367-382. <doi:10.1007/s10980-013-9984-8>

See Also

plot

Examples

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)
## Not run: 
rocd <- ROC(index, boolean, mask, progress = TRUE)
rocd

## End(Not run)

## generate the ROC curve using non-spatial data (i.e., an object of class numeric)
## Not run: 
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

## End(Not run)

[Package TOC version 0.0-6 Index]