code: @Override
  	public double calculateExpectedAgreement() {
  		Map<Object, Integer> annotationsPerCategory
  				= CodingAnnotationStudy.countTotalAnnotationsPerCategory(study);
  
  		BigDecimal result = BigDecimal.ZERO;
  		for (Object category : study.getCategories()) {
  			Integer catCount = annotationsPerCategory.get(category);
  			if (catCount != null)
  				result = result.add(new BigDecimal(catCount).pow(2));
  		}
  		result = result.divide(new BigDecimal(4).multiply(
  				new BigDecimal(study.getItemCount()).pow(2)), MathContext.DECIMAL128);
  		return result.doubleValue();
  	}
docs: Calculates the expected inter-rater agreement that assumes the same
  distribution for all raters and annotations.
  @throws NullPointerException if the annotation study is null.
  @throws ArithmeticException if there are no items in the
  annotation study.