View source: R/oc_youden_kernel.R
oc_youden_kernel | R Documentation |
Instead of searching for an optimal cutpoint to maximize (sensitivity +
specificity - 1) on the ROC curve, this function first smoothes the empirical
distributions of x
per class. The smoothing is done using a binned kernel
density estimate. The bandwidth is automatically selected using the direct
plug-in method.
oc_youden_kernel(data, x, class, pos_class, neg_class, direction, ...)
data |
A data frame or tibble in which the columns that are given in x and class can be found. |
x |
(character) The variable name to be used for classification, e.g. predictions or test values. |
class |
(character) The variable name indicating class membership. |
pos_class |
The value of class that indicates the positive class. |
neg_class |
The value of class that indicates the negative class. |
direction |
(character) Use ">=" or "<=" to select whether an x value >= or <= the cutoff predicts the positive class. |
... |
To capture further arguments that are always passed to the method function by cutpointr. The cutpointr function passes data, x, class, metric_func, direction, pos_class and neg_class to the method function. |
The functions for calculating the kernel density estimate and the bandwidth are both from KernSmooth with default parameters, except for the bandwidth selection, which uses the standard deviation as scale estimate.
The cutpoint is estimated as the cutpoint that maximizes the Youden-Index given by J = max_c {F_N(c) - G_N(c) } where J and G are the smoothed distribution functions.
Fluss, R., Faraggi, D., & Reiser, B. (2005). Estimation of the Youden Index and its associated cutoff point. Biometrical Journal, 47(4), 458–472.
Matt Wand (2015). KernSmooth: Functions for Kernel Smoothing Supporting Wand & Jones (1995). R package version 2.23-15. https://CRAN.R-project.org/package=KernSmooth
Other method functions:
maximize_boot_metric()
,
maximize_gam_metric()
,
maximize_loess_metric()
,
maximize_metric()
,
maximize_spline_metric()
,
oc_manual()
,
oc_mean()
,
oc_median()
,
oc_youden_normal()
data(suicide) if (require(KernSmooth)) { oc_youden_kernel(suicide, "dsi", "suicide", oc_metric = "Youden", pos_class = "yes", neg_class = "no", direction = ">=") ## Within cutpointr cutpointr(suicide, dsi, suicide, method = oc_youden_kernel) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.