robKappa: Robust Cohen's Kappa

View source: R/robKappa.R

robKappaR Documentation

Robust Cohen's Kappa

Description

Compute a robust version of Cohen's Kappa coefficient.

Usage

robKappa(
  actual = NULL,
  predicted = NULL,
  TP = NULL,
  FN = NULL,
  FP = NULL,
  TN = NULL,
  d = 0.1
)

Arguments

actual

A vector of actual values (1/0 or TRUE/FALSE)

predicted

A vector of prediction values (1/0 or TRUE/FALSE)

TP

Count of true positives (correctly predicted 1/TRUE)

FN

Count of false negatives (predicted 0/FALSE, but actually 1/TRUE)

FP

Count of false positives (predicted 1/TRUE, but actually 0/FALSE)

TN

Count of true negatives (correctly predicted 0/FALSE)

d

Nonnegative robustness parameter. With d = 0, the result is Cohen's Kappa.

Details

Calculate the robust Cohen's Kappa coefficient. Provide either:

  • actual and predicted or

  • TP, FN, FP and TN.

If d=0, the robust Cohen's Kappa coefficient coincides with Cohen's Kappa.

Value

Robust Cohen's Kappa coefficient.

References

Holzmann, H., Klar, B. (2026). Robust performance metrics for imbalanced classification problems. arXiv:2404.07661. LINK

Examples

actual <- c(1,1,1,1,1,1,0,0,0,0)
predicted <- c(1,1,1,1,0,0,1,0,0,0)
robKappa(actual, predicted, d=0.1)
robKappa(TP=4, FN=2, FP=1, TN=3, d=0.1)


RobustMetrics documentation built on Aug. 21, 2026, 5:17 p.m.