Learn R Programming

reproducer (version 0.7.0)

compute_wmcc: compute_wmcc

Description

Computes the Weighted Matthews Correlation Coefficient (WMCC) from confusion matrix counts (Madeyski, Kitchenham and Shepperd 2026, Equation 6). Each positive example (TP, FN) is weighted by w and each negative example (TN, FP) by 1 before the standard MCC formula is applied, where w is the FN:FP cost ratio (a missed relevant study is w times more costly than screening an irrelevant one). w = 1 reduces to the standard MCC (compute_mcc). The function is vectorised over the confusion matrix counts.

Usage

compute_wmcc(TP, FP, FN, TN, w = 10)

Value

the Weighted 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).

w

the FN:FP cost ratio (default 10).

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), cost ratio w = 10
compute_wmcc(TP = 128, FP = 68, FN = 20, TN = 232, w = 10)

Run the code above in your browser using DataLab