Matthews Correlation Coefficient
Calculate the Matthews correlation coefficient (MCC) from confusion matrix values. Free online classifier evaluation tool with sensitivity, specificity, precision, accuracy, and F1 score.
About This Calculator
The Matthews correlation coefficient (MCC) is a powerful statistical measure used to evaluate the quality of binary classifications in machine learning, medical diagnostics, bioinformatics, and quality control. Unlike simple accuracy, MCC provides a balanced assessment that works well even when the classes being predicted are of very different sizes. The calculator accepts the four values of a confusion matrix — true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN) — and computes MCC along with sensitivity, specificity, precision, accuracy, and F1 score.
The formula for MCC is: MCC = (TP × TN - FP × FN) / √[(TP + FP)(TP + FN)(TN + FP)(TN + FN)]. The coefficient ranges from -1 to +1, where +1 indicates perfect prediction, 0 indicates no better than random, and -1 indicates complete disagreement. The accompanying metrics provide a comprehensive picture of classifier performance: sensitivity (recall) tells you how well the model finds positive cases, specificity measures how well it identifies negative cases, precision evaluates the reliability of positive predictions, accuracy gives the overall correctness rate, and the F1 score balances precision and recall into a single measure.
Regional Notes
India: MCC is widely used in Indian research institutions and hospitals for evaluating diagnostic tests and machine learning models. The Indian Council of Medical Research (ICMR) recommends balanced metrics like MCC for evaluating medical screening tools where class imbalance is common.
United States: MCC is the standard evaluation metric recommended by the FDA for binary classification models in medical device software. It is also extensively used in US-based bioinformatics and computational biology research for evaluating protein structure prediction and genomic classification models.
United Kingdom: The UK's National Institute for Health and Care Excellence (NICE) considers MCC alongside sensitivity and specificity when evaluating diagnostic technologies. UK universities and research institutions commonly report MCC in machine learning and epidemiology studies as a robust alternative to accuracy.
Frequently Asked Questions
What is the Matthews correlation coefficient?
The Matthews correlation coefficient (MCC) is a measure of the quality of binary classifications. It takes into account true positives, true negatives, false positives, and false negatives to produce a single coefficient ranging from -1 (complete disagreement) through 0 (no better than random) to +1 (perfect prediction). MCC is widely used in machine learning, bioinformatics, and medical diagnostics as a balanced metric that works well even when classes are of different sizes.
How is the Matthews correlation coefficient calculated?
MCC is calculated using the formula: MCC = (TP × TN - FP × FN) / √[(TP + FP)(TP + FN)(TN + FP)(TN + FN)], where TP is true positives, TN is true negatives, FP is false positives, and FN is false negatives. The denominator is the geometric mean of the four products, ensuring MCC is a balanced measure that requires all four confusion matrix categories to be considered.
What is a good Matthews correlation coefficient value?
An MCC of +1 represents a perfect prediction, 0 means the prediction is no better than random, and -1 indicates total disagreement between prediction and observation. In practice, MCC values above 0.7 are considered strong, 0.5 to 0.7 moderate, and below 0.5 weak. The interpretation depends on the domain — medical diagnostics typically require higher MCC values than general ML classification tasks.
What is the difference between MCC and accuracy?
Accuracy measures the proportion of correct predictions (TP + TN) out of total predictions, while MCC accounts for all four confusion matrix values and produces a balanced coefficient between -1 and +1. When classes are imbalanced (e.g., 95% negative, 5% positive), accuracy can be misleadingly high by always predicting the majority class, while MCC correctly penalizes such a strategy by producing a value near 0.
Can MCC be used for multi-class classification?
Yes, MCC can be extended to multi-class classification problems. The multi-class MCC sums the confusion matrix values across all classes to produce a single coefficient. The formula generalizes to handle K × K confusion matrices, providing a balanced measure that works for binary, multi-class, and multi-label classification tasks. The value still ranges from -1 to +1.
What are sensitivity, specificity, precision, and F1 score?
Sensitivity (recall) = TP / (TP + FN) measures how many actual positives are correctly identified. Specificity = TN / (TN + FP) measures how many actual negatives are correctly identified. Precision = TP / (TP + FP) measures how many predicted positives are actually positive. F1 score = 2 × (Precision × Recall) / (Precision + Recall) is the harmonic mean of precision and recall, providing a single score that balances both metrics.
When should I use MCC instead of F1 score?
MCC is preferred over F1 score when evaluating binary classifications on imbalanced datasets. While F1 score focuses on positive class performance (ignoring true negatives), MCC considers all four confusion matrix categories and produces a more reliable metric when classes are skewed. Research in bioinformatics and machine learning recommends MCC as the standard metric for binary classification evaluation.