Use this function to calculate the MCC scores given vectors of TP (true positives), FP (false positives), TN (true negatives) and FN (false negatives) values. Note that the input vectors have to be of the same size and have one-to-one value correspondence for the output MCC vector to make sense.

calculate_mcc(tp, tn, fp, fn)

Arguments

tp

numeric vector of TPs

tn

numeric vector of TNs

fp

numeric vector of FPs

fn

numeric vector of FNs

Value

a numeric vector of MCC values, each value being in the [-1,1] interval. If any of the four sums of the MCC formula are zero, then we return an MCC score of zero, which can be shown to be the correct limiting value (model is no better than a random predictor, see Chicco et al. (2020), doi: 10.1186/s12864-019-6413-7 ).

See also