public static Result calcResult(int truePositives, int falsePositives,
			int falseNegatives, int trueNegatives) {
		double precision = truePositives / (float) (truePositives + falsePositives);
		double recall = truePositives / (float) (truePositives + falseNegatives);
		double fScore = 2 * ((precision * recall) / (precision + recall));
		double hitRate = recall; // HR and recall are the same measurement
		double faRate = falsePositives / (float) (trueNegatives + falsePositives);
		double aPrime = .5 + (((hitRate - faRate) * (1 + hitRate - faRate)) / (4 * hitRate * ( 1 - faRate)));
		// B double prime as given by Donaldson (1992):
		// B"D = [(1 - H)(l - FA) - HFA] / [(1 - H)(l - FA) + HFA]
		double bDoublePrime = (((1 - hitRate) * (1 - faRate) - (hitRate * faRate)) /
				((1 - hitRate) * (1 - faRate) + (hitRate * faRate)));

		// Correct for any NaNs by changing to zero
		precision = Double.isNaN(precision) ? 0.0 : precision;
		recall = Double.isNaN(recall) ? 0.0 : recall;
		fScore = Double.isNaN(fScore) ? 0.0 : fScore;
		aPrime = Double.isNaN(aPrime) || Double.isInfinite(aPrime) ? 0.0 : aPrime;

		Result r = new Result(precision, recall, fScore, hitRate, faRate, aPrime, bDoublePrime);
		return r;
	}