List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getSkewness
public double getSkewness()
From source file:com.github.jessemull.microflex.stat.statinteger.SkewnessIntegerTest.java
/** * Tests the aggregated plate statistics method using the values between the indices. *//*from www .ja va2s .com*/ @Test public void testAggregatedPlateIndices() { for (PlateInteger 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<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(mean.platesAggregated(plate, begin, end - begin), precision); for (WellInteger well : plate) { resultList.addAll(well.toDouble().subList(begin, end)); } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double aggregatedResult = Precision.round(statAggregated.getSkewness(), precision); assertTrue(aggregatedResult == aggregatedReturned); } }
From source file:com.github.jessemull.microflex.stat.statinteger.SkewnessIntegerTest.java
/** * Tests the aggregated plate statistics method using the values between the indices. *//* ww w . j a v a 2 s .c o m*/ @Test public void testAggregatedSetIndices() { for (PlateInteger 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<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(mean.setsAggregated(plate.dataSet(), begin, end - begin), precision); for (WellInteger well : plate) { resultList.addAll(well.toDouble().subList(begin, end)); } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = Precision.round(statAggregated.getSkewness(), precision); assertTrue(resultAggregated == aggregatedReturned); } }
From source file:com.github.jessemull.microflex.stat.statinteger.SkewnessIntegerTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./*from www. j av a 2 s . c om*/ */ @Test public void testAggregatedSetArrayIndices() { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); WellSetInteger[] setArrayIndices = new WellSetInteger[arrayIndices.length]; for (int i = 0; i < setArrayIndices.length; i++) { setArrayIndices[i] = arrayIndices[i].dataSet(); } Map<WellSetInteger, Double> aggregatedReturnedMap = mean.setsAggregated(setArrayIndices, begin, end - begin); Map<WellSetInteger, Double> aggregatedResultMap = new TreeMap<WellSetInteger, Double>(); for (WellSetInteger set : setArrayIndices) { List<Double> resultList = new ArrayList<Double>(); for (WellInteger well : set) { resultList.addAll(well.toDouble().subList(begin, end)); } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double aggregatedResult = statAggregated.getSkewness(); aggregatedResultMap.put(set, aggregatedResult); } for (WellSetInteger plate : setArrayIndices) { double result = Precision.round(aggregatedResultMap.get(plate), precision); double returned = Precision.round(aggregatedReturnedMap.get(plate), precision); assertTrue(result == returned); } }
From source file:com.github.jessemull.microflexdouble.stat.SkewnessTest.java
/** * Tests well calculation using indices. *//* www.j a v a 2 s . c o m*/ @Test public void testWellIndices() { for (Plate plate : arrayIndices) { for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double result = Precision.round(stat.getSkewness(), precision); double returned = Precision.round(mean.well(well, begin, end - begin), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statdouble.SkewnessDoubleTest.java
/** * Tests well calculation using indices. *//*from www . j av a2 s . c o m*/ @Test public void testWellIndices() { for (PlateDouble plate : arrayIndices) { for (WellDouble well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double result = Precision.round(stat.getSkewness(), precision); double returned = Precision.round(mean.well(well, begin, end - begin), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statinteger.SkewnessIntegerTest.java
/** * Tests well calculation using indices. *///from w ww. ja v a2s. co m @Test public void testWellIndices() { for (PlateInteger plate : arrayIndices) { for (WellInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double result = Precision.round(stat.getSkewness(), precision); double returned = Precision.round(mean.well(well, begin, end - begin), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.SkewnessBigDecimalTest.java
/** * Tests well calculation.//ww w. ja va2 s . c o m */ @Test public void testWell() { for (PlateBigDecimal plate : array) { for (WellBigDecimal well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigDecimal bd : well) { input[index++] = bd.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getSkewness(); BigDecimal returned = skewness.well(well, mc); BigDecimal result = new BigDecimal(resultDouble); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SkewnessTest.java
/** * Tests well calculation.//from w ww . j a v a 2s . c o m */ @Test public void testWell() { for (Plate plate : array) { for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigDecimal bd : well) { input[index++] = bd.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getSkewness(); BigDecimal returned = skewness.well(well, mc); BigDecimal result = new BigDecimal(resultDouble); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.SkewnessTest.java
/** * Tests well calculation.//from www.j a v a2 s .c o m */ @Test public void testWell() { for (Plate plate : array) { for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index++] = bi.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getSkewness(); BigDecimal returned = skewness.well(well, mc); BigDecimal result = new BigDecimal(resultDouble); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SkewnessBigIntegerTest.java
/** * Tests well calculation./* w w w .j ava2 s.co m*/ */ @Test public void testWell() { for (PlateBigInteger plate : array) { for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index++] = bi.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getSkewness(); BigDecimal returned = skewness.well(well, mc); BigDecimal result = new BigDecimal(resultDouble); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }