protected static void getStats(List<Element<DoublePair>> pairs, List<Double> uniqueValues, List<DoublePair> stats) {
		if (pairs.size() == 0) {
			return;
		}
		double lastValue = pairs.get(0).weight;
		double totalWeight = pairs.get(0).element.v2;
		double sum = pairs.get(0).element.v1 * totalWeight;
		double lastResp = pairs.get(0).element.v1;
		boolean isStd0 = true;
		for (int i = 1; i < pairs.size(); i++) {
			Element<DoublePair> element = pairs.get(i);
			double value = element.weight;
			double weight = element.element.v2;
			double resp = element.element.v1;
			if (value != lastValue) {
				uniqueValues.add(lastValue);
				stats.add(new DoublePair(totalWeight, sum));
				lastValue = value;
				totalWeight = weight;
				sum = resp * weight;
				lastResp = resp;
				isStd0 = true;
			} else {
				totalWeight += weight;
				sum += weight * resp;
				isStd0 = isStd0 && (lastResp == resp);
			}
		}
		uniqueValues.add(lastValue);
		stats.add(new DoublePair(totalWeight, sum));
	}