Accuracy can mislead when one class is rare. The Matthews correlation coefficient calculator takes the true positives, false positives, false negatives and true negatives, and gives the MCC, plus the accuracy, the F1 score and Youden’s J so you can compare them.
How the calculation works
- Enter the four cells of your confusion matrix: true positives, false positives, false negatives and true negatives.
- The Matthews correlation coefficient is MCC = (TP × TN − FP × FN) ÷ √((TP + FP)(TP + FN)(TN + FP)(TN + FN)).
- It ranges from −1, a perfect inverse prediction, through 0, no better than chance, to +1, a perfect prediction.
- The calculator also shows the accuracy, the F1 score and Youden’s J for comparison.
Example
A test gives 85 true positives, 15 false positives, 25 false negatives and 175 true negatives. The numerator is 85 × 175 − 15 × 25 = 14,500 and the denominator is √(100 × 110 × 200 × 190) ≈ 20,445, so MCC = 0.7092. Accuracy is 86.67 %, the F1 score is 0.8095 and Youden’s J is 0.6938.
Why it matters
Machine learning practitioners, diagnostic test developers and bioinformaticians use MCC because it treats both classes fairly. Many publications now report it next to accuracy and F1 for binary classification, and it is especially useful when a model must be compared across datasets with very different shares of positive cases.
Good to know
MCC describes one operating point of a classifier. It does not show how performance changes with the decision threshold, which is what an ROC curve shows. For more than two classes, a multiclass version exists but is not covered here. Report the four counts along with the MCC so that readers can recompute any other metric they prefer.
Related tools
The confusion matrix calculator gives more standard metrics from the same four counts, and the correlation significance calculator explains the idea behind MCC.