Learn R Programming

reproducer (version 0.7.0)

compute_mcc: compute_mcc

Description

Computes the Matthews Correlation Coefficient (MCC) from confusion matrix counts, as recommended for evaluating the performance of large language models for screening literature in systematic reviews by Madeyski, Kitchenham and Shepperd (2026). The MCC is the standard, unrescaled coefficient in the range \([-1, 1]\); it is chance-anchored, so a value of 0 indicates random-level performance. The function is vectorised: TP, FP, FN, TN may be scalars or equal-length vectors.

Usage

compute_mcc(TP, FP, FN, TN)

Value

the Matthews Correlation Coefficient (NaN when the denominator is 0).

Arguments

TP

the number of true positives (scalar or vector).

FP

the number of false positives (scalar or vector).

FN

the number of false negatives (scalar or vector).

TN

the number of true negatives (scalar or vector).

Author

Lech Madeyski

References

Lech Madeyski, Barbara Kitchenham, Martin Shepperd (2026). LLM4SCREENLIT: Recommendations on assessing the performance of large language models for screening literature in systematic reviews. Information and Software Technology, 198, 108204. doi:10.1016/j.infsof.2026.108204.

Examples

Run this code
# Felizardo et al. SLR2, Likert >= 4 (paper Table 3)
compute_mcc(TP = 128, FP = 68, FN = 20, TN = 232)

Run the code above in your browser using DataLab