List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getSkewness
public double getSkewness()
From source file:com.github.jessemull.microflexbigdecimal.stat.SkewnessTest.java
/** * Tests the aggregated plate statistics method using a collection. *//* w w w . j a v a2s .c om*/ @Test public void testAggregatedPlateCollection() { List<Plate> collection = Arrays.asList(array); Map<Plate, BigDecimal> aggregatedReturnedMap = skewness.platesAggregated(collection, mc); Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>(); for (Plate plate : collection) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : collection) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SkewnessTest.java
/** * Tests the aggregated plate statistics method using an array. *///from w w w .j av a2 s . co m @Test public void testAggregatedPlateArray() { Map<Plate, BigDecimal> aggregatedReturnedMap = skewness.platesAggregated(array, mc); Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>(); for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : array) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbiginteger.stat.SkewnessTest.java
/** * Tests the aggregated plate statistics method using a collection. *//*from w w w . jav a2 s . c o m*/ @Test public void testAggregatedPlateCollection() { List<Plate> collection = Arrays.asList(array); Map<Plate, BigDecimal> aggregatedReturnedMap = skewness.platesAggregated(collection, mc); Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>(); for (Plate plate : collection) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : collection) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbiginteger.stat.SkewnessTest.java
/** * Tests the aggregated plate statistics method using an array. */// w ww. jav a2s . co m @Test public void testAggregatedPlateArray() { Map<Plate, BigDecimal> aggregatedReturnedMap = skewness.platesAggregated(array, mc); Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>(); for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : array) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SkewnessBigIntegerTest.java
/** * Tests the aggregated plate statistics method using a collection. */// w ww. ja va 2 s.c o m @Test public void testAggregatedPlateCollection() { List<PlateBigInteger> collection = Arrays.asList(array); Map<PlateBigInteger, BigDecimal> aggregatedReturnedMap = skewness.platesAggregated(collection, mc); Map<PlateBigInteger, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigInteger, BigDecimal>(); for (PlateBigInteger plate : collection) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateBigInteger plate : collection) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SkewnessBigIntegerTest.java
/** * Tests the aggregated plate statistics method using an array. *//*from ww w . ja v a 2 s .com*/ @Test public void testAggregatedPlateArray() { Map<PlateBigInteger, BigDecimal> aggregatedReturnedMap = skewness.platesAggregated(array, mc); Map<PlateBigInteger, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigInteger, BigDecimal>(); for (PlateBigInteger plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateBigInteger plate : array) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.SkewnessBigDecimalTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./*from w w w .j a v a 2 s. co m*/ */ @Test public void testAggregatedPlateArrayIndices() { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); Map<PlateBigDecimal, BigDecimal> aggregatedReturnedMap = skewness.platesAggregated(arrayIndices, begin, end - begin, mc); Map<PlateBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigDecimal, BigDecimal>(); for (PlateBigDecimal plate : arrayIndices) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateBigDecimal plate : arrayIndices) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SkewnessTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./*from ww w . ja va2s . co m*/ */ @Test public void testAggregatedPlateArrayIndices() { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); Map<Plate, BigDecimal> aggregatedReturnedMap = skewness.platesAggregated(arrayIndices, begin, end - begin, mc); Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>(); for (Plate plate : arrayIndices) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : arrayIndices) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.SkewnessBigDecimalTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the collection./* www. j av a2 s . co m*/ */ @Test public void testAggregatedPlateCollectionIndices() { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); List<PlateBigDecimal> collection = Arrays.asList(arrayIndices); Map<PlateBigDecimal, BigDecimal> aggregatedReturnedMap = skewness.platesAggregated(collection, begin, end - begin, mc); Map<PlateBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigDecimal, BigDecimal>(); for (PlateBigDecimal plate : collection) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateBigDecimal plate : collection) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.SkewnessBigDecimalTest.java
/** * Tests the aggregated plate statistics method using a collection. *///from w w w . j a v a 2 s . c om @Test public void testAggregatedSetCollection() { List<WellSetBigDecimal> collection = new ArrayList<WellSetBigDecimal>(); for (PlateBigDecimal plate : array) { collection.add(plate.dataSet()); } Map<WellSetBigDecimal, BigDecimal> aggregatedReturnedMap = skewness.setsAggregated(collection, mc); Map<WellSetBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<WellSetBigDecimal, BigDecimal>(); for (WellSetBigDecimal set : collection) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (WellBigDecimal well : set) { 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.getSkewness(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(set, aggregatedResult); } for (WellSetBigDecimal set : collection) { BigDecimal result = aggregatedResultMap.get(set); BigDecimal returned = aggregatedReturnedMap.get(set); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }