R/fourStats.R

# #author: Max Kuhn on http://caret.r-forge.r-project.org/custom_models.html
# 
# fourStats <- function (data, lev = levels(data$obs), model = NULL) {
#   ## This code will get use the area under the ROC curve and the
#   ## sensitivity and specificity values using the current candidate
#   ## value of the probability threshold.
#   out <- c(twoClassSummary(data, lev = levels(data$obs), model = NULL))
#   
#   ## The best possible model has sensitivity of 1 and specificity of 1. 
#   ## How far are we from that value?
#   coords <- matrix(c(1, 1, out["Spec"], out["Sens"]),
#                    ncol = 2,
#                    byrow = TRUE)
#   colnames(coords) <- c("Spec", "Sens")
#   rownames(coords) <- c("Best", "Current")
#   c(out, Dist = dist(coords)[1])
# }
environmentalinformatics-marburg/gpm documentation built on July 11, 2020, 11:12 a.m.