yardstick (version 0.0.1)

mcc: Other Metrics for 2x2 Tables

Description

General metrics for two class problems that are not already in sens() or recall() are here, such as the Matthews correlation coefficient, Youden's J.

There is no common convention on which factor level should automatically be considered the "event" or "positive" results. In yardstick, the default is to use the first level. To change this, a global option called yardstick.event_first is set to TRUE when the package is loaded. This can be changed to FALSE if the last level of the factor is considered the level of interest.

Usage

mcc(data, ...)

# S3 method for data.frame mcc(data, truth, estimate, na.rm = TRUE, ...)

# S3 method for table mcc(data, ...)

j_index(data, ...)

# S3 method for data.frame j_index(data, truth, estimate, na.rm = TRUE, ...)

# S3 method for table j_index(data, ...)

Arguments

data

For the default functions, a factor containing the discrete measurements. For the table or matrix functions, a table or matrix object, respectively, where the true class results should be in the columns of the table.

...

Not currently used.

truth

The column identifier for the true class results (that is a factor). This should an unquoted column name although this argument is passed by expression and support quasiquotation (you can unquote column names or column positions).

estimate

The column identifier for the predicted class results (that is also factor). As with truth this can be specified different ways but the primary method is to use an unquoted variable name.

na.rm

A logical value indicating whether NA values should be stripped before the computation proceeds

Details

If more than one statistic is required, it is more computationally efficient to create the confusion matrix using conf_mat() and applying the corresponding summary method (summary.conf_mat()) to get the values at once.

See Also

conf_mat(), summary.conf_mat(), recall(), sens()

Examples

Run this code
# NOT RUN {
data("two_class_example")

mcc(two_class_example, truth, predicted)

j_index(two_class_example, truth, predicted)
# }

Run the code above in your browser using DataLab