matthews {alookr} | R Documentation |
Compute Matthews Correlation Coefficient
Description
compute the Matthews correlation coefficient with actual and predict values.
Usage
matthews(predicted, y, positive)
Arguments
predicted |
numeric. the predicted value of binary classification |
y |
factor or character. the actual value of binary classification |
positive |
level of positive class of binary classification |
Details
The Matthews Correlation Coefficient has a value between -1 and 1, and the closer to 1, the better the performance of the binary classification.
Value
numeric. The Matthews Correlation Coefficient.
Examples
# simulate actual data
set.seed(123L)
actual <- sample(c("Y", "N"), size = 100, prob = c(0.3, 0.7), replace = TRUE)
actual
# simulate predict data
set.seed(123L)
pred <- sample(c("Y", "N"), size = 100, prob = c(0.2, 0.8), replace = TRUE)
pred
# simulate confusion matrix
table(pred, actual)
matthews(pred, actual, "Y")
[Package alookr version 0.3.9 Index]