optCutoff {MKclass}R Documentation

Compute the Optimal Cutoff for Binary Classification

Description

The function computes the optimal cutoff for various performance weasures for binary classification.

Usage

optCutoff(pred, truth, namePos, perfMeasure = "YJS",
          MAX = TRUE, parallel = FALSE, ncores, delta = 0.01, ...)

Arguments

pred

numeric values that shall be used for classification; e.g. probabilities to belong to the positive group.

truth

true grouping vector or factor.

namePos

value representing the positive group.

perfMeasure

a single performance measure computed by function perfMeasure.

MAX

logical value. Whether to maximize or minimize the performacne measure.

parallel

logical value. If TRUE packages foreach and doParallel are used to parallelize the computations.

ncores

integer value, number of cores that shall be used to parallelize the computations.

delta

numeric value for setting up grid for optimization; start is minimum of pred-delta, end is maximum of pred+delta.

...

further arguments passed to function prefMeasures.

Details

The function is able to compute the optimal cutoff for various performance measures, all performance measures that are implemented in function perfMeasures. Of course, for several of them the computation is not really usefull such as sensitivity or specificity where one will get trivial cutoffs.

Value

Optimal cutoff and value of the optimized performance measure based on a simple grid search.

Author(s)

Matthias Kohl Matthias.Kohl@stamats.de

Examples

## example from dataset infert
fit <- glm(case ~ spontaneous+induced, data = infert, family = binomial())
pred <- predict(fit, type = "response")
optCutoff(pred, truth = infert$case, namePos = 1)

[Package MKclass version 0.5 Index]