/** Computes the maximum possible value of the kappa coefficient for the * provided study. In case of balanced off-marginals (i.e., an equal * disagreement for each pair of categories), the maximum kappa is 1. * In other cases, it decreases with a higher discrepancy of the * distribution of disagreements. */ public double calculateMaximumAgreement() { double A_O = calculateMaximumObservedAgreement(); double A_E = calculateExpectedAgreement(); if (A_E == 0.0) return A_O; else return (A_O - A_E) / (1.0 - A_E); }