Skip to contents

Returns the best cutpoint for a given classification model.

Usage

BestCut(x, method = c("youden", "closest.topleft"))

Arguments

x

a roc object from the roc function

method

one of "youden" or "closest.topleft", controls how the optimal threshold is determined. See details.

Details

The method argument controls how the optimal threshold is determined.

'youden'

Youden's J statistic (Youden, 1950) is employed. The optimal cut-off is the threshold that maximizes the distance to the identity (diagonal) line. Can be shortened to “y”.

The optimality criterion is: $$max(sensitivities + specificities)$$

'closest.topleft'

The optimal threshold is the point closest to the top-left part of the plot with perfect sensitivity or specificity. Can be shortened to “c” or “t”.

The optimality criterion is: $$min((1 - sensitivities)^2 + (1- specificities)^2)$$

Value

the threshold value

References

Xavier Robin, Natacha Turck, Alexandre Hainard, et al. (2011) “pROC: an open-source package for R and S+ to analyze and compare ROC curves”. BMC Bioinformatics, 7, 77. doi:10.1186/1471-2105-12-77 .

Author

Robin Xavier <pROC-cran@xavier.robin.name>, Andri Signorell <andri@signorell.net> (interface)

See also

Examples

r.glm <- FitMod(diabetes ~ ., data = d.pima, fitfn="logit")

ROC(r.glm)
#> Setting levels: control = neg, case = pos
#> Setting direction: controls < cases
#> 
#> Call:
#> roc.default(response = Response(x), predictor = predict(x, type = "prob")[,     2], plot = FALSE)
#> 
#> Data: predict(x, type = "prob")[, 2] in 500 controls (Response(x) neg) < 268 cases (Response(x) pos).
#> Area under the curve: 0.8394
BestCut(ROC(r.glm))
#> Setting levels: control = neg, case = pos
#> Setting direction: controls < cases
#>   threshold specificity sensitivity 
#>   0.3536825   0.7840000   0.7388060