List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getVariance
public double getVariance()
From source file:com.github.jessemull.microflexbigdecimal.stat.SampleVarianceTest.java
/** * Tests the aggregated plate statistics method. */// w ww . ja v a 2 s. c o m @Test public void testAggregatedPlate() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, mc); for (Well well : plate) { resultList.addAll(well.data()); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SampleVarianceTest.java
/** * Tests the aggregated plate statistics method. */// w w w .java 2 s .c o m @Test public void testAggregatedSet() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), mc); for (Well well : plate) { resultList.addAll(well.data()); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbiginteger.stat.SampleVarianceTest.java
/** * Tests the aggregated plate statistics method. *///from w w w.j a va 2s . co m @Test public void testAggregatedPlate() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, mc); for (Well well : plate) { resultList.addAll(well.toBigDecimal()); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbiginteger.stat.SampleVarianceTest.java
/** * Tests the aggregated plate statistics method. *//* w ww . ja v a2 s . c o m*/ @Test public void testAggregatedSet() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), mc); for (Well well : plate) { resultList.addAll(well.toBigDecimal()); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SampleVarianceBigIntegerTest.java
/** * Tests the aggregated plate statistics method. *///from w ww.ja v a 2s .c o m @Test public void testAggregatedPlate() { for (PlateBigInteger plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, mc); for (WellBigInteger well : plate) { resultList.addAll(well.toBigDecimal()); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SampleVarianceBigIntegerTest.java
/** * Tests the aggregated plate statistics method. *//* w w w. j a v a2 s .c o m*/ @Test public void testAggregatedSet() { for (PlateBigInteger plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), mc); for (WellBigInteger well : plate) { resultList.addAll(well.toBigDecimal()); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.SampleVarianceBigDecimalTest.java
/** * Tests the aggregated plate statistics method using the values between the indices. *//*from w ww . ja va 2s. c o m*/ @Test public void testAggregatedPlateIndices() { for (PlateBigDecimal plate : arrayIndices) { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, begin, end - begin, mc); for (WellBigDecimal well : plate) { resultList.addAll(well.data().subList(begin, end)); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.SampleVarianceBigDecimalTest.java
/** * Tests the aggregated plate statistics method using the values between the indices. *//* w w w. j a v a2s . com*/ @Test public void testAggregatedSetIndices() { for (PlateBigDecimal plate : arrayIndices) { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), begin, end - begin, mc); for (WellBigDecimal well : plate) { resultList.addAll(well.data().subList(begin, end)); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SampleVarianceTest.java
/** * Tests the aggregated plate statistics method using the values between the indices. */// w w w . j av a 2 s . co m @Test public void testAggregatedPlateIndices() { for (Plate plate : arrayIndices) { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.platesAggregated(plate, begin, end - begin, mc); for (Well well : plate) { resultList.addAll(well.data().subList(begin, end)); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SampleVarianceTest.java
/** * Tests the aggregated plate statistics method using the values between the indices. */// ww w .j ava 2s .c o m @Test public void testAggregatedSetIndices() { for (Plate plate : arrayIndices) { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = variance.setsAggregated(plate.dataSet(), begin, end - begin, mc); for (Well well : plate) { resultList.addAll(well.data().subList(begin, end)); } 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); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }