public String chi2(HashMap<String, String> treeChoises) {
		HashMap<String, Integer> partialFrequenzies = getPartialFrequenzies(treeChoises);

		double numerator = 0;
		double denominator = 0;
		for (String key : partialFrequenzies.keySet()) {
			denominator += frequenzy.get(key);
			numerator += partialFrequenzies.get(key);
		}
		double q = numerator / denominator;

		HashMap<String, Double> freqHat = new HashMap<String, Double>();

		for (String key : partialFrequenzies.keySet()) {
			double val = frequenzy.get(key) * q;
			freqHat.put(key, val);
		}

		double delta = 0;

		for (String key : partialFrequenzies.keySet()) {
			double a = Math.pow(partialFrequenzies.get(key) - freqHat.get(key),
					2);
			double b = freqHat.get(key);

			delta += a / b;
		}

		if (delta > chi2.get(partialFrequenzies.size() - 1)) {
			return null;
		}

		int max = -1;
		String maxKey = null;

		for (String key : partialFrequenzies.keySet()) {
			int i = partialFrequenzies.get(key);
			if (i > max) {
				max = i;
				maxKey = key;
			}
		}
		return maxKey;
	}