Learn R Programming

rfUtilities (version 2.1-4)

occurrence.threshold: Test occurrence probability thresholds

Description

A statistical sensitivity test for occurrence probability thresholds

Usage

occurrence.threshold(x, xdata, class, p = seq(0.1, 0.7, 0.02),
  type = "delta.ss")

Arguments

x

A classification randomForest model object

xdata

Independent data used to build model

class

What class to test

p

Vector of probability thresholds

type

What statistic to use in evaluation ("delta.ss", "sum.ss", "kappa")

Value

An "occurrence.threshold" class object containing a "thresholds" vector object with evaluation statistic and probability thresholds as names.

Details

Available threshold evaluation statistics:

  • kappa - The Kappa statistic is maximized

  • sum.ss - The sum of sensitivity and specificity is maximized

  • delta.ss - The absolute value of the difference between sensitivity and specificity is minimized

References

Jimenez-Valverde, A., & J.M. Lobo (2007). Threshold criteria for conversion of probability of species presence to either-or presence-absence. Acta Oecologica 31(3):361-369

Liu, C., P.M. Berry, T.P. Dawson, R.G. Pearson (2005). Selecting thresholds of occurrence in the prediction of species distributions. Ecography 28:385-393.

Examples

Run this code
# NOT RUN {
library(randomForest)
 data(imports85)
  imp85 <- imports85[,-2] 
  imp85 <- imp85[complete.cases(imp85), ]
  imp85[] <- lapply(imp85, function(x) if (is.factor(x)) x[, drop=TRUE] else x)

y <- ifelse( imp85$numOfDoors != "four", "0", "1")   
( rf.mdl <- randomForest(y = as.factor(y), x = imp85[,-5]) )
   ( delta.ss.t <- occurrence.threshold(rf.mdl, imp85[,-5], class = "1") )
   ( sum.ss.t <- occurrence.threshold(rf.mdl, imp85[,-5], class = "1", 
                                      type = "sum.ss") ) 
   ( kappa.ss.t <- occurrence.threshold(rf.mdl, imp85[,-5], class = "1",
                                      type = "kappa") )
  
par(mfrow=c(2,2))
  plot(sum.ss.t)
  plot(delta.ss.t)
  plot(kappa.ss.t)   
  
# }

Run the code above in your browser using DataLab