powered by
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)
cohens_kappa(tp, fp, tn, fn, ...)
(numeric) number of true positives.
(numeric) number of false positives.
(numeric) number of true negatives.
(numeric) number of false negatives.
for capturing additional arguments passed by method.
A numeric matrix with the column name "cohens_kappa".
Other metric functions: F1_score, abs_d_ppv_npv, abs_d_sens_spec, accuracy, cutpoint, false_omission_rate, misclassification_cost, npv, odds_ratio, p_chisquared, plr, ppv, precision, prod_ppv_npv, prod_sens_spec, recall, risk_ratio, sensitivity, specificity, sum_ppv_npv, sum_sens_spec, total_utility, tpr, tp, youden
F1_score
abs_d_ppv_npv
abs_d_sens_spec
accuracy
cutpoint
false_omission_rate
misclassification_cost
npv
odds_ratio
p_chisquared
plr
ppv
precision
prod_ppv_npv
prod_sens_spec
recall
risk_ratio
sensitivity
specificity
sum_ppv_npv
sum_sens_spec
total_utility
tpr
tp
youden
# NOT RUN { cohens_kappa(10, 5, 20, 10) cohens_kappa(c(10, 8), c(5, 7), c(20, 12), c(10, 18)) # }
Run the code above in your browser using DataLab