calculate_mcc_f1: Calculate MCC and F1 score

View source: R/utils.R

calculate_mcc_f1R Documentation

Calculate MCC and F1 score

Description

Given binary observed and predicted response, estimate Matthews correlation coefficient (MCC) and the F1 score.

Usage

calculate_mcc_f1(observed, predicted)

Arguments

observed

logical or 0/1; the observed binary response.

predicted

logical or 0/1; the predicted binary response. This will typically need to be generated by applying a threshold to the continuous predicted response.

Value

A list with two elements: mcc and f1.

Examples

obs <- c(rep(1L, 1000L), rep(0L, 10000L))
pred <- c(rbeta(300L, 12, 2), rbeta(700L, 3, 4), rbeta(10000L, 2, 3))
calculate_mcc_f1(obs > 0, pred > 0.5)

ebirdst documentation built on Nov. 16, 2023, 5:07 p.m.