Learn R Programming

ebirdst (version 3.2022.3)

calculate_mcc_f1: 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)

Value

A list with two elements: mcc and f1.

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab