Description Usage Arguments Details Value Author(s) References Examples
View source: R/occurrence.threshold.R
A statistical sensitivity test for occurrence probability thresholds
1 2 | occurrence.threshold(x, xdata, class, p = seq(0.1, 0.7, 0.02),
type = "delta.ss")
|
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") |
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
An "occurrence.threshold" class object containing a "thresholds" vector object with evaluation statistic and probability thresholds as names.
Jeffrey S. Evans <jeffrey_evans<at>tnc.org>
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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)
|
rfUtilities 2.1-1
Type rfu.news() to see new features/changes/bug fixes.
randomForest 4.6-12
Type rfNews() to see new features/changes/bug fixes.
Call:
randomForest(x = imp85[, -5], y = as.factor(y))
Type of random forest: classification
Number of trees: 500
No. of variables tried at each split: 4
OOB estimate of error rate: 10.88%
Confusion matrix:
0 1 class.error
0 67 14 0.1728395
1 7 105 0.0625000
Evaluation statistic: delta.ss
Moments for thresholds:
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.00000 0.01786 0.04464 0.08415 0.12346 0.38272
Probability threshold with minimum delta sensitivity/specificity = 0.46
Evaluation statistic: sum.ss
Moments for thresholds:
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.617 1.877 1.955 1.916 1.982 2.000
Probability threshold with maximum cummlative sensitivity/specificity = 0.46
Evaluation statistic: kappa
Moments for thresholds:
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.6518 0.8918 0.9572 0.9224 0.9788 1.0000
Probability threshold with maximum kappa = 0.46
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.