code: @Override
  	public double calculateCategoryAgreement(final Object category) {
  		// N = # subjects = #items -> index i
  		// n = # ratings/subject = #raters
  		// k = # categories -> index j
  		// n_ij = # raters that annotated item i as category j
  		//
  		// k_j = (P_j - p_j) / (1 - p_j)
  		// P_j = (sum( n_ij^2 ) - N n p_j) / (N n (n-1) p_j )
  		// p_j = 1/Nn sum n_ij
  
  		int N = study.getItemCount();
  		int n = study.getRaterCount();
  		int sum_nij = 0;
  		int sum_nij_2 = 0;
  		for (ICodingAnnotationItem item : study.getItems()) {
  			int nij = 0;
  			for (IAnnotationUnit unit : item.getUnits())
  				if (unit.getCategory().equals(category))
  					nij++;
  			sum_nij += nij;
  			sum_nij_2 += (nij * nij);
  		}
  
  		double pj = 1 / (double) (N * n) * sum_nij;
  		double Pj = (sum_nij_2 - N * n * pj) / (double) (N * n * (n - 1) * pj);
  		double kappaj = (Pj - pj) / (double) (1 - pj);
  		return kappaj;
  	}
docs: Artstein&Poesio have a different definition!