
Last chance! 50% off unlimited learning
Sale ends in
calcAUC(sens, cspec)
sens
sens
and cspc
should be in the same order with respect to the threshold value
so that their elements correspond. That is, if the first element of sens
was calculated at a
threshold value of 0.01 and the second at a threshold value of 0.02, then the first element of cpsec
should be also be calculated at a threshold value of 0.01 and the second at a threshold value of 0.02, and
so on. The AUC is approximated using the trapezoid method, and can take real values between 0 and 1. An
AUC of 0.5 indicates a classifier with random performance, and an AUC of 1 indicates a classifer with
perfect performance.library(ebdbNet)
tmp <- runif(1) ## Initialize random number generator
## Generate artificial values for sensitivity and complementary specificity.
fn <- function(x) {return(-1/(x^7)+1)}
set.seed(1459)
sens <- c(fn(seq(1, 2.7, length = 100)),1) ## Sensitivity
cspec <- seq(0, 1, by = 0.01) ## Complementary specificity
## Calculate the AUC of the ROC curve
AUC <- calcAUC(sens, cspec) ## AUC of this ROC curve is 0.9030868
Run the code above in your browser using DataLab