List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getMin
public double getMin()
From source file:com.github.jessemull.microflexbigdecimal.stat.MinTest.java
/** * Tests the aggregated plate statistics method using an array. *///from w w w .j av a2 s . com @Test public void testAggregatedPlateArray() { Map<Plate, BigDecimal> aggregatedReturnedMap = min.platesAggregated(array); 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.getMin(); 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:knop.utils.stats.DataSet.java
/** * Gets the minimum column size.// ww w .j av a 2 s . c om * * @return the minimum column size */ public int getMinimumColumnSize() { DescriptiveStatistics stats = new DescriptiveStatistics(); for (String column : getColumnList()) { stats.addValue(getColumnSize(column)); } return MathUtils.round(stats.getMin()); }
From source file:com.github.jessemull.microflexbigdecimal.stat.MinTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./* ww w . j a va 2 s . c o 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 = min.platesAggregated(arrayIndices, begin, end - begin); 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.getMin(); 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.MinBigDecimalTest.java
/** * Tests the aggregated plate statistics method using a collection. *///from w w w . j av a 2s . co m @Test public void testAggregatedPlateCollection() { List<PlateBigDecimal> collection = Arrays.asList(array); Map<PlateBigDecimal, BigDecimal> aggregatedReturnedMap = min.platesAggregated(collection); 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()); } 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.getMin(); 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.MinBigDecimalTest.java
/** * Tests the aggregated plate statistics method using an array. */// w ww .jav a 2s .c o m @Test public void testAggregatedPlateArray() { Map<PlateBigDecimal, BigDecimal> aggregatedReturnedMap = min.platesAggregated(array); Map<PlateBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigDecimal, BigDecimal>(); for (PlateBigDecimal plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (WellBigDecimal 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.getMin(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateBigDecimal 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.microflexbigdecimal.stat.MinTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the collection.//from www .j a va2 s . co m */ @Test public void testAggregatedPlateCollectionIndices() { List<Plate> collection = Arrays.asList(arrayIndices); 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 = min.platesAggregated(arrayIndices, begin, end - begin); 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().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.getMin(); 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.microflexbigdecimal.stat.MinTest.java
/** * Tests the aggregated plate statistics method using a collection. *//* www . ja v a 2s . c o m*/ @Test public void testAggregatedSetCollection() { List<WellSet> collection = new ArrayList<WellSet>(); for (Plate plate : array) { collection.add(plate.dataSet()); } Map<WellSet, BigDecimal> aggregatedReturnedMap = min.setsAggregated(collection); Map<WellSet, BigDecimal> aggregatedResultMap = new TreeMap<WellSet, BigDecimal>(); for (WellSet set : collection) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (Well 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.getMin(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(set, aggregatedResult); } for (WellSet set : collection) { BigDecimal result = aggregatedResultMap.get(set); BigDecimal returned = aggregatedReturnedMap.get(set); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbiginteger.stat.MinTest.java
/** * Tests the plate statistics method.//from w w w .j a va 2 s .c o m */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = min.plate(plate); 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.getMin(); BigDecimal result = new BigDecimal(resultDouble); resultMap.put(well, result); } for (Well well : plate) { BigDecimal result = resultMap.get(well); BigDecimal returned = returnedMap.get(well); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.itemanalysis.jmetrik.stats.descriptives.DescriptiveAnalysis.java
public void publishTable(VariableAttributes v) { TextTable table = null;/*from w ww . j a va2 s .c o m*/ TextTableColumnFormat[] cformats = new TextTableColumnFormat[2]; cformats[0] = new TextTableColumnFormat(); cformats[0].setStringFormat(15, TextTableColumnFormat.OutputAlignment.LEFT); cformats[1] = new TextTableColumnFormat(); cformats[1].setDoubleFormat(10, 4, TextTableColumnFormat.OutputAlignment.RIGHT); DescriptiveStatistics temp = data.get(v); table = new TextTable(); table.addAllColumnFormats(cformats, 17); table.getRowAt(0).addHeader(0, 2, v.getName().toString(), TextTablePosition.CENTER); table.getRowAt(1).addHorizontalRule(0, 2, "="); table.getRowAt(2).addHeader(0, 1, "Statistic", TextTablePosition.CENTER); table.getRowAt(2).addHeader(1, 1, "Value", TextTablePosition.CENTER); table.getRowAt(3).addHorizontalRule(0, 2, "-"); table.addStringAt(4, 0, "N"); table.addDoubleAt(4, 1, maxProgress); table.addStringAt(5, 0, "Valid N"); table.addDoubleAt(5, 1, temp.getN()); table.addStringAt(6, 0, "Min"); table.addDoubleAt(6, 1, temp.getMin()); table.addStringAt(7, 0, "Max"); table.addDoubleAt(7, 1, temp.getMax()); table.addStringAt(8, 0, "Mean"); table.addDoubleAt(8, 1, temp.getMean()); table.addStringAt(9, 0, "Std. Dev."); table.addDoubleAt(9, 1, temp.getStandardDeviation()); table.addStringAt(10, 0, "Skewness"); table.addDoubleAt(10, 1, temp.getSkewness()); table.addStringAt(11, 0, "Kurtosis"); table.addDoubleAt(11, 1, temp.getKurtosis()); table.addStringAt(12, 0, "First Quartile"); table.addDoubleAt(12, 1, temp.getPercentile(25)); table.addStringAt(13, 0, "Median"); table.addDoubleAt(13, 1, temp.getPercentile(50)); table.addStringAt(14, 0, "Third Quartile"); table.addDoubleAt(14, 1, temp.getPercentile(75)); table.addStringAt(15, 0, "IQR"); table.addDoubleAt(15, 1, temp.getPercentile(75) - temp.getPercentile(25)); table.getRowAt(16).addHorizontalRule(0, 2, "="); publish(table.toString() + "\n"); }
From source file:com.github.jessemull.microflexbigdecimal.stat.MinTest.java
/** * Tests the aggregated plate statistics method using an array. *//*w w w . j a va2s .c o m*/ @Test public void testAggregatedSetArray() { WellSet[] setArray = new WellSet[array.length]; for (int i = 0; i < setArray.length; i++) { setArray[i] = array[i].dataSet(); } Map<WellSet, BigDecimal> aggregatedReturnedMap = min.setsAggregated(setArray); Map<WellSet, BigDecimal> aggregatedResultMap = new TreeMap<WellSet, BigDecimal>(); for (WellSet set : setArray) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (Well 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.getMin(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(set, aggregatedResult); } for (WellSet set : setArray) { BigDecimal result = aggregatedResultMap.get(set); BigDecimal returned = aggregatedReturnedMap.get(set); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }