List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getStandardDeviation
public double getStandardDeviation()
From source file:com.github.jessemull.microflexinteger.stat.StandardDeviationTest.java
/** * Tests the aggregated plate statistics method using an array. *//* w w w . j a v a 2s.co m*/ @Test public void testAggregatedPlateArray() { Map<Plate, Double> aggregatedReturnedMap = deviation.platesAggregated(array); Map<Plate, Double> aggregatedResultMap = new TreeMap<Plate, Double>(); for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); 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 aggregatedResult = statAggregated.getStandardDeviation(); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : array) { double result = Precision.round(aggregatedResultMap.get(plate), precision); double returned = Precision.round(aggregatedReturnedMap.get(plate), precision); assertTrue(result == returned); } }
From source file:gdsc.smlm.ij.plugins.PSFEstimator.java
private void setParams(int i, double[] params, double[] params_dev, DescriptiveStatistics sample) { if (sample.getN() > 0) { params[i] = sample.getMean();// w ww .ja v a 2 s .c om params_dev[i] = sample.getStandardDeviation(); } }
From source file:com.github.jessemull.microflexdouble.stat.SampleStandardDeviationTest.java
/** * Tests the aggregated plate statistics method using a collection. */// w ww. j a va 2 s.c o m @Test public void testAggregatedPlateCollection() { List<Plate> collection = Arrays.asList(array); Map<Plate, Double> aggregatedReturnedMap = deviation.platesAggregated(collection); 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.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 aggregatedResult = statAggregated.getStandardDeviation(); aggregatedResultMap.put(plate, aggregatedResult); } 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.microflexdouble.stat.SampleStandardDeviationTest.java
/** * Tests the aggregated plate statistics method using an array. */// w ww . j a va 2 s . c o m @Test public void testAggregatedPlateArray() { Map<Plate, Double> aggregatedReturnedMap = deviation.platesAggregated(array); Map<Plate, Double> aggregatedResultMap = new TreeMap<Plate, Double>(); for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); 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 aggregatedResult = statAggregated.getStandardDeviation(); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : array) { 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.StandardDeviationTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./*w ww . j a v a 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 = deviation.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.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.getStandardDeviation(); 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.SampleStandardDeviationDoubleTest.java
/** * Tests the aggregated plate statistics method using a collection. *//* w w w. ja va2 s .c o m*/ @Test public void testAggregatedPlateCollection() { List<PlateDouble> collection = Arrays.asList(array); Map<PlateDouble, Double> aggregatedReturnedMap = deviation.platesAggregated(collection); Map<PlateDouble, Double> aggregatedResultMap = new TreeMap<PlateDouble, Double>(); for (PlateDouble plate : collection) { List<Double> resultList = new ArrayList<Double>(); for (WellDouble 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 aggregatedResult = statAggregated.getStandardDeviation(); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateDouble 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.statdouble.SampleStandardDeviationDoubleTest.java
/** * Tests the aggregated plate statistics method using an array. *//*from w ww . ja v a2 s. co m*/ @Test public void testAggregatedPlateArray() { Map<PlateDouble, Double> aggregatedReturnedMap = deviation.platesAggregated(array); Map<PlateDouble, Double> aggregatedResultMap = new TreeMap<PlateDouble, Double>(); for (PlateDouble plate : array) { List<Double> resultList = new ArrayList<Double>(); for (WellDouble 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 aggregatedResult = statAggregated.getStandardDeviation(); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateDouble plate : array) { 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.SampleStandardDeviationTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./*from w ww . j a va 2 s . c om*/ */ @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 = deviation.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.getStandardDeviation(); 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.statinteger.StandardDeviationIntegerTest.java
/** * Tests the aggregated plate statistics method using a collection. *///from w ww.j a va 2s.c o m @Test public void testAggregatedPlateCollection() { List<PlateInteger> collection = Arrays.asList(array); Map<PlateInteger, Double> aggregatedReturnedMap = deviation.platesAggregated(collection); 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()); } 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.getStandardDeviation(); aggregatedResultMap.put(plate, aggregatedResult); } 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.StandardDeviationIntegerTest.java
/** * Tests the aggregated plate statistics method using an array. */// www. java 2s . com @Test public void testAggregatedPlateArray() { Map<PlateInteger, Double> aggregatedReturnedMap = deviation.platesAggregated(array); Map<PlateInteger, Double> aggregatedResultMap = new TreeMap<PlateInteger, Double>(); for (PlateInteger plate : array) { List<Double> resultList = new ArrayList<Double>(); 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 aggregatedResult = statAggregated.getStandardDeviation(); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateInteger plate : array) { double result = Precision.round(aggregatedResultMap.get(plate), precision); double returned = Precision.round(aggregatedReturnedMap.get(plate), precision); assertTrue(result == returned); } }