List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getVariance
public double getVariance()
From source file:com.github.jessemull.microflex.stat.statbiginteger.SampleVarianceBigIntegerWeightsTest.java
/** * Tests the aggregated plate statistics method. *//*from w w w. j a v a 2 s. com*/ @Test public void testAggregatedPlate() { for (PlateBigInteger plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, weights, mc); for (WellBigInteger well : plate) { List<BigDecimal> input = well.toBigDecimal(); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weights[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SampleVarianceBigIntegerWeightsTest.java
/** * Tests the aggregated plate statistics method. *//*from w ww .j a v a2s. co m*/ @Test public void testAggregatedSet() { for (PlateBigInteger plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), weights, mc); for (WellBigInteger well : plate) { List<BigDecimal> input = well.toBigDecimal(); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weights[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbiginteger.stat.SampleVarianceWeightsTest.java
/** * Tests the aggregated plate statistics method. *//*from w ww. j a v a 2 s . co m*/ @Test public void testAggregatedPlate() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, weights, mc); for (Well well : plate) { List<BigDecimal> input = well.toBigDecimal(); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weights[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbiginteger.stat.SampleVarianceWeightsTest.java
/** * Tests the aggregated plate statistics method. *//* w w w. jav a 2s.c om*/ @Test public void testAggregatedSet() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), weights, mc); for (Well well : plate) { List<BigDecimal> input = well.toBigDecimal(); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weights[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.SampleVarianceBigDecimalWeightsTest.java
/** * Tests the aggregated plate statistics method. */// w w w . j av a 2 s .c o m @Test public void testAggregatedPlate() { for (PlateBigDecimal plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, weights, mc); for (WellBigDecimal well : plate) { List<BigDecimal> input = well.data(); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weights[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.SampleVarianceBigDecimalWeightsTest.java
/** * Tests the aggregated plate statistics method. *//* w w w . j av a2s . c o m*/ @Test public void testAggregatedSet() { for (PlateBigDecimal plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), weights, mc); for (WellBigDecimal well : plate) { List<BigDecimal> input = well.data(); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weights[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SampleVarianceWeightsTest.java
/** * Tests the aggregated plate statistics method. *///w w w . j a v a 2 s . co m @Test public void testAggregatedPlate() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, weights, mc); for (Well well : plate) { List<BigDecimal> input = well.data(); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weights[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SampleVarianceWeightsTest.java
/** * Tests the aggregated plate statistics method. *///from w w w . j a va2 s. co m @Test public void testAggregatedSet() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), weights, mc); for (Well well : plate) { List<BigDecimal> input = well.data(); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weights[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SampleVarianceBigIntegerWeightsTest.java
/** * Tests the aggregated plate statistics method using the values between the indices. *//*ww w . j av a2s .co m*/ @Test public void testAggregatedPlateIndices() { for (PlateBigInteger plate : arrayIndices) { int begin = random.nextInt(plate.first().size() - 4); int end = begin + random.nextInt(3) + 3; List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, weightsIndices, begin, end - begin, mc); for (WellBigInteger well : plate) { List<BigDecimal> input = well.toBigDecimal().subList(begin, end); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weightsIndices[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SampleVarianceBigIntegerWeightsTest.java
/** * Tests the aggregated plate statistics method using the values between the indices. *//*from w w w .j a v a2 s .com*/ @Test public void testAggregatedSetIndices() { for (PlateBigInteger plate : arrayIndices) { int begin = random.nextInt(plate.first().size() - 4); int end = begin + random.nextInt(3) + 3; List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), weightsIndices, begin, end - begin, mc); for (WellBigInteger well : plate) { List<BigDecimal> input = well.toBigDecimal().subList(begin, end); for (int i = 0; i < input.size(); i++) { resultList.add(input.get(i).multiply(new BigDecimal(weightsIndices[i]))); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getVariance(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }