cohens_kappa {cutpointr} R Documentation

## Calculate Cohen's Kappa

### Description

Calculate the Kappa metric from true positives, false positives, true negatives and false negatives. The inputs must be vectors of equal length.

mrg_a = ((tp + fn) * (tp + fp)) / (tp + fn + fp + tn)
mrg_b = ((fp + tn) * (fn + tn)) / (tp + fn + fp + tn)
expec_agree = (mrg_a + mrg_b) / (tp + fn + fp + tn)
obs_agree = (tp + tn) / (tp + fn + fp + tn)
cohens_kappa = (obs_agree - expec_agree) / (1 - expec_agree)

### Usage

cohens_kappa(tp, fp, tn, fn, ...)


### Arguments

 tp (numeric) number of true positives. fp (numeric) number of false positives. tn (numeric) number of true negatives. fn (numeric) number of false negatives. ... for capturing additional arguments passed by method.

### Value

A numeric matrix with the column name "cohens_kappa".

Other metric functions: F1_score(), Jaccard(), abs_d_ppv_npv(), abs_d_sens_spec(), accuracy(), cutpoint(), false_omission_rate(), metric_constrain(), misclassification_cost(), npv(), odds_ratio(), p_chisquared(), plr(), ppv(), precision(), prod_ppv_npv(), prod_sens_spec(), recall(), risk_ratio(), roc01(), sensitivity(), specificity(), sum_ppv_npv(), sum_sens_spec(), total_utility(), tpr(), tp(), youden()
cohens_kappa(10, 5, 20, 10)