List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics DescriptiveStatistics
public DescriptiveStatistics(DescriptiveStatistics original) throws NullArgumentException
From source file:experiment.ExperimentLogger.java
public void recordMean(double[][] allUtil) { content.append("Total utility: "); DescriptiveStatistics stats0 = new DescriptiveStatistics(allUtil[0]); DescriptiveStatistics stats1 = new DescriptiveStatistics(allUtil[1]); String mean1 = Double.toString(stats0.getMean()) + "+-" + Double.toString(stats0.getStandardDeviation()); String mean2 = Double.toString(stats1.getMean()) + "+-" + Double.toString(stats1.getStandardDeviation()); content.append(mean1);/*from w ww. j av a 2 s .c o m*/ content.append("\t" + mean2); content.append(ret); recordConfig(mean1 + "\t" + mean2); }
From source file:com.github.jessemull.microflexdouble.stat.SkewnessTest.java
/** * Tests the aggregated plate statistics method. *///from w ww.j a v a 2 s . c o m @Test public void testAggregatedPlate() { for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(mean.platesAggregated(plate), precision); 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); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = Precision.round(statAggregated.getSkewness(), precision); assertTrue(resultAggregated == aggregatedReturned); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.PopulationVarianceBigIntegerWeightsTest.java
/** * Tests the plate statistics method using the values between the indices. *//*from ww w .ja v a 2 s .com*/ @Test public void testPlateIndices() { for (PlateBigInteger plate : arrayIndices) { int begin = random.nextInt(plate.first().size() - 4); int end = begin + random.nextInt(3) + 3; Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = variance.plate(plate, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weightsIndices[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getPopulationVariance(); BigDecimal result = new BigDecimal(resultDouble, mc); resultMap.put(well, result); } for (WellBigInteger 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.github.jessemull.microflexinteger.stat.SkewnessTest.java
/** * Tests the aggregated plate statistics method. *//*w w w . j a va 2s . c o m*/ @Test public void testAggregatedPlate() { for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(mean.platesAggregated(plate), precision); for (Well well : plate) { resultList.addAll(well.toDouble()); } 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.microflexdouble.stat.SumOfSquaresTest.java
/** * Tests the aggregated plate statistics method. *//* w w w . j a va 2 s.c o m*/ @Test public void testAggregatedPlate() { for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(sum.platesAggregated(plate), precision); 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); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = Precision.round(statAggregated.getSumsq(), precision); assertTrue(resultAggregated == aggregatedReturned); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SumOfSquaresBigIntegerTest.java
/** * Tests the plate statistics method using the values between the indices. *///w ww.ja v a2 s .c om @Test public void testPlateIndices() { for (PlateBigInteger plate : arrayIndices) { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = sum.plate(plate, begin, end - begin, mc); 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(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getSumsq(); BigDecimal result = new BigDecimal(resultDouble); resultMap.put(well, result); } for (WellBigInteger 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.github.jessemull.microflexdouble.stat.KurtosisTest.java
/** * Tests the aggregated plate statistics method. *///from ww w. j ava 2 s . c o m @Test public void testAggregatedPlate() { for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(kurtosis.platesAggregated(plate), precision); 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); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = Precision.round(statAggregated.getKurtosis(), precision); assertTrue(resultAggregated == aggregatedReturned); } }
From source file:com.github.jessemull.microflexinteger.stat.KurtosisTest.java
/** * Tests the aggregated plate statistics method. */// w w w.j a v a2 s. c om @Test public void testAggregatedPlate() { for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(kurtosis.platesAggregated(plate), precision); for (Well well : plate) { resultList.addAll(well.toDouble()); } 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.getKurtosis(), precision); assertTrue(resultAggregated == aggregatedReturned); } }
From source file:com.github.jessemull.microflexinteger.stat.SumOfSquaresTest.java
/** * Tests the aggregated plate statistics method. *///ww w.j a va 2 s . c om @Test public void testAggregatedPlate() { for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(sum.platesAggregated(plate), precision); for (Well well : plate) { resultList.addAll(well.toDouble()); } 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.getSumsq(), precision); assertTrue(resultAggregated == aggregatedReturned); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.PopulationVarianceWeightsTest.java
/** * Tests the plate statistics method using the values between the indices. *///from w w w . jav a 2s. c om @Test public void testPlateIndices() { for (Plate plate : arrayIndices) { int begin = random.nextInt(plate.first().size() - 4); int end = begin + random.nextInt(3) + 3; Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = variance.plate(plate, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigDecimal bd : well) { input[index] = bd.doubleValue() * weightsIndices[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getPopulationVariance(); BigDecimal result = new BigDecimal(resultDouble, mc); 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]); } } }