List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getMean
public double getMean()
From source file:com.github.jessemull.microflex.stat.statinteger.MeanIntegerTest.java
/** * Tests well calculation using indices. *//*w w w. j a v a2 s . c o 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.getMean(), precision); double returned = Precision.round(mean.well(well, begin, end - begin), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflexdouble.stat.MeanWeightsTest.java
/** * Tests the plate statistics method.//w w w . ja va 2 s. co m */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, Double> resultMap = new TreeMap<Well, Double>(); Map<Well, Double> returnedMap = mean.plate(plate, weights); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index] = db * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getMean(); resultMap.put(well, result); } for (Well well : plate) { double result = Precision.round(resultMap.get(well), precision); double returned = Precision.round(returnedMap.get(well), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statdouble.MeanDoubleWeightsTest.java
/** * Tests the plate statistics method.//w ww. java 2s . c o m */ @Test public void testPlate() { for (PlateDouble plate : array) { Map<WellDouble, Double> resultMap = new TreeMap<WellDouble, Double>(); Map<WellDouble, Double> returnedMap = mean.plate(plate, weights); for (WellDouble well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index] = db * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getMean(); resultMap.put(well, result); } for (WellDouble well : plate) { double result = Precision.round(resultMap.get(well), precision); double returned = Precision.round(returnedMap.get(well), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statinteger.MeanIntegerWeightsTest.java
/** * Tests the plate statistics method./*from w w w. j a v a 2 s . co m*/ */ @Test public void testPlate() { for (PlateInteger plate : array) { Map<WellInteger, Double> resultMap = new TreeMap<WellInteger, Double>(); Map<WellInteger, Double> returnedMap = mean.plate(plate, weights); for (WellInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index] = db * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getMean(); resultMap.put(well, result); } for (WellInteger well : plate) { double result = Precision.round(resultMap.get(well), precision); double returned = Precision.round(returnedMap.get(well), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflexdouble.stat.MeanWeightsTest.java
/** * Tests set calculation./*from ww w . j ava 2 s . c om*/ */ @Test public void testSet() { for (Plate plate : array) { Map<Well, Double> resultMap = new TreeMap<Well, Double>(); Map<Well, Double> returnedMap = mean.set(plate.dataSet(), weights); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index] = db * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getMean(); resultMap.put(well, result); } for (Well well : plate) { double result = Precision.round(resultMap.get(well), precision); double returned = Precision.round(returnedMap.get(well), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statdouble.MeanDoubleWeightsTest.java
/** * Tests set calculation.// w w w . jav a 2 s .co m */ @Test public void testSet() { for (PlateDouble plate : array) { Map<WellDouble, Double> resultMap = new TreeMap<WellDouble, Double>(); Map<WellDouble, Double> returnedMap = mean.set(plate.dataSet(), weights); for (WellDouble well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index] = db * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getMean(); resultMap.put(well, result); } for (WellDouble well : plate) { double result = Precision.round(resultMap.get(well), precision); double returned = Precision.round(returnedMap.get(well), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statinteger.MeanIntegerWeightsTest.java
/** * Tests set calculation./*from w w w. java2s. com*/ */ @Test public void testSet() { for (PlateInteger plate : array) { Map<WellInteger, Double> resultMap = new TreeMap<WellInteger, Double>(); Map<WellInteger, Double> returnedMap = mean.set(plate.dataSet(), weights); for (WellInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index] = db * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getMean(); resultMap.put(well, result); } for (WellInteger well : plate) { double result = Precision.round(resultMap.get(well), precision); double returned = Precision.round(returnedMap.get(well), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflexdouble.stat.MeanWeightsTest.java
/** * Tests well calculation./*from w w w. j a va2 s . co m*/ */ @Test public void testWell() { for (Plate plate : array) { for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index] = db * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = Precision.round(stat.getMean(), precision); double returned = Precision.round(mean.well(well, weights), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statdouble.MeanDoubleWeightsTest.java
/** * Tests well calculation.// w w w .j a v a 2 s .co m */ @Test public void testWell() { for (PlateDouble plate : array) { for (WellDouble well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index] = db * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = Precision.round(stat.getMean(), precision); double returned = Precision.round(mean.well(well, weights), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statinteger.MeanIntegerWeightsTest.java
/** * Tests well calculation./*from w ww . ja v a2 s .c om*/ */ @Test public void testWell() { for (PlateInteger plate : array) { for (WellInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index] = db * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = Precision.round(stat.getMean(), precision); double returned = Precision.round(mean.well(well, weights), precision); assertTrue(result == returned); } } }