evalMultiAUC {enmSdmX} | R Documentation |
Calculate multivariate weighted AUC
Description
This function calculates a multivariate version of the area under the receiver-operator characteristic curve (AUC). The multivariate version is simply the mean AUC across all possible pairwise AUCs for all cases (Hand & Till 2001). For example, if we have predictions that can be classified into three groups of expectation, say A, B, and C, where we expect predictions assigned to group A are > those in B and C, and predictions in group B are expected to be > those in group C, the multivariate AUC for this situation is mean(wAB * auc_mean(A, B), wAC * auc_mean(A, C), wBC * auc_mean(B, C))
, where auc_mean(X, Y)
, is the AUC calculated between cases X
and Y
, and wXY
is a weight for that case-comparison.
Usage
evalMultiAUC(..., weightBySize = FALSE, na.rm = FALSE)
Arguments
... |
A set of two or more numeric vectors or two or more 2-column matrices or data frames. The objects must be listed in order of expected probability. For example, you might have a set of predictions for objects you expect to have a low predicted probability (e.g., long-term absences of an animal), a set that you expect to have middle levels of probability (e.g., sites that were recently vacated), and a set for which you expect a high level of predicted probability (e.g., sites that are currently occupied). In this case you should list the cases in order: low, middle, high. If a 2-column matrix or data frame is supplied, then the first column is assumed to represent predictions and the second assumed to represent site-level weights (see |
weightBySize |
Logical, if |
na.rm |
Logical. If |
Value
Named numeric vector. The names will appear as case2_over_case1
(which in this example means the AUC of item #1 in the ...
when compared to the second item in ...
), plus multivariate
(which is the multivariate AUC).
References
Hand, DJ and Till, RJ. 2001. A simple generalisation of the area under the ROC curve for multiple class classification problems. Machine Learning 45:171-186 doi:10.1023/A:1010920819831.
See Also
pa_evaluate
, evalAUC
, evalContBoyce
, evalThreshold
, evalThresholdStats
, evalTjursR2
, evalTSS
Examples
set.seed(123)
# no weights
low <- runif(10)^2
middle <- runif(10)
high <- sqrt(runif(20))
evalMultiAUC(low, middle, high)
# equal weights
low <- matrix(c(low, rep(1, length(low))), ncol=2)
middle <- matrix(c(middle, rep(1, length(middle))), ncol=2)
high <- matrix(c(high, rep(1, length(high))), ncol=2)
evalMultiAUC(low, middle, high)
# equal weights with weighting by number of comparisons
evalMultiAUC(low, middle, high, weightBySize=TRUE)
# unequal weights
middle[ , 2] <- ifelse(middle[ , 1] > 0.5, 0.1, 1)
evalMultiAUC(low, middle, high)
# unequal weights with weighting by number of comparisons
evalMultiAUC(low, middle, high, weightBySize=TRUE)