List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getSumsq
public double getSumsq()
From source file:com.github.jessemull.microflex.stat.statinteger.SumOfSquaresIntegerTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./*from w w 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<PlateInteger, Double> aggregatedReturnedMap = sum.platesAggregated(arrayIndices, begin, end - begin); Map<PlateInteger, Double> aggregatedResultMap = new TreeMap<PlateInteger, Double>(); for (PlateInteger plate : arrayIndices) { List<Double> resultList = new ArrayList<Double>(); 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 = statAggregated.getSumsq(); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateInteger plate : arrayIndices) { 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.SumOfSquaresTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./*from www .java 2s . 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, Double> aggregatedReturnedMap = sum.platesAggregated(arrayIndices, begin, end - begin); Map<Plate, Double> aggregatedResultMap = new TreeMap<Plate, Double>(); for (Plate plate : arrayIndices) { List<Double> resultList = new ArrayList<Double>(); 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); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double aggregatedResult = statAggregated.getSumsq(); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : arrayIndices) { 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.microflex.stat.statdouble.SumOfSquaresDoubleTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./*ww w. j a v a 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<PlateDouble, Double> aggregatedReturnedMap = sum.platesAggregated(arrayIndices, begin, end - begin); Map<PlateDouble, Double> aggregatedResultMap = new TreeMap<PlateDouble, Double>(); for (PlateDouble plate : arrayIndices) { List<Double> resultList = new ArrayList<Double>(); for (WellDouble 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); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double aggregatedResult = statAggregated.getSumsq(); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateDouble plate : arrayIndices) { 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.microflexinteger.stat.SumOfSquaresTest.java
/** * Tests the aggregated plate statistics method. */// www . j a v a2 s .com @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.microflexinteger.stat.SumOfSquaresTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the collection./*from w ww . j a v a 2s . c om*/ */ @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<Plate> collection = Arrays.asList(arrayIndices); Map<Plate, Double> aggregatedReturnedMap = sum.platesAggregated(collection, begin, end - begin); Map<Plate, Double> aggregatedResultMap = new TreeMap<Plate, Double>(); for (Plate plate : collection) { List<Double> resultList = new ArrayList<Double>(); for (Well 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 = statAggregated.getSumsq(); aggregatedResultMap.put(plate, resultAggregated); } for (Plate plate : collection) { 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.microflexinteger.stat.SumOfSquaresTest.java
/** * Tests the aggregated plate statistics method. *///from ww w . jav a 2 s .c om @Test public void testAggregatedSet() { for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(sum.setsAggregated(plate.dataSet()), 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.microflexinteger.stat.SumOfSquaresTest.java
/** * Tests the aggregated plate statistics method using a collection. */// www . j a v a2 s. c o m @Test public void testAggregatedSetCollection() { List<WellSet> collection = new ArrayList<WellSet>(); for (Plate plate : array) { collection.add(plate.dataSet()); } Map<WellSet, Double> aggregatedReturnedMap = sum.setsAggregated(collection); Map<WellSet, Double> aggregatedResultMap = new TreeMap<WellSet, Double>(); for (WellSet set : collection) { List<Double> resultList = new ArrayList<Double>(); for (Well well : set) { 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 aggregatedResult = statAggregated.getSumsq(); aggregatedResultMap.put(set, aggregatedResult); } for (WellSet set : collection) { double result = Precision.round(aggregatedResultMap.get(set), precision); double returned = Precision.round(aggregatedReturnedMap.get(set), precision); assertTrue(result == returned); } }
From source file:com.github.jessemull.microflex.stat.statinteger.SumOfSquaresIntegerTest.java
/** * Tests the aggregated plate statistics method. */// ww w. java2s . c o m @Test public void testAggregatedPlate() { for (PlateInteger plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(sum.platesAggregated(plate), precision); for (WellInteger 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.microflex.stat.statinteger.SumOfSquaresIntegerTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the collection.//from w w w . ja va 2 s . c o 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<PlateInteger> collection = Arrays.asList(arrayIndices); Map<PlateInteger, Double> aggregatedReturnedMap = sum.platesAggregated(collection, begin, end - begin); Map<PlateInteger, Double> aggregatedResultMap = new TreeMap<PlateInteger, Double>(); for (PlateInteger plate : collection) { List<Double> resultList = new ArrayList<Double>(); 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 = statAggregated.getSumsq(); aggregatedResultMap.put(plate, resultAggregated); } for (PlateInteger plate : collection) { 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.microflex.stat.statinteger.SumOfSquaresIntegerTest.java
/** * Tests the aggregated plate statistics method. *//* w w w. ja va 2s .co m*/ @Test public void testAggregatedSet() { for (PlateInteger plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(sum.setsAggregated(plate.dataSet()), precision); for (WellInteger 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); } }