List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics DescriptiveStatistics
public DescriptiveStatistics(DescriptiveStatistics original) throws NullArgumentException
From source file:com.github.jessemull.microflex.stat.statdouble.PopulationVarianceDoubleTest.java
/** * Tests the plate statistics method./* w w w . ja v a 2s. c o m*/ */ @Test public void testPlate() { for (PlateDouble plate : array) { Map<WellDouble, Double> resultMap = new TreeMap<WellDouble, Double>(); Map<WellDouble, Double> returnedMap = variance.plate(plate); for (WellDouble well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getPopulationVariance(); 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.microflexdouble.stat.SumOfSquaresWeightsTest.java
/** * Tests the plate statistics method./*from w w w. ja v a 2 s . c om*/ */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, Double> resultMap = new TreeMap<Well, Double>(); Map<Well, Double> returnedMap = sum.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.getSumsq(); 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.microflexdouble.stat.GeometricMeanWeightsTest.java
/** * Tests the plate statistics method.//from ww w. java 2s .c o 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.getGeometricMean(); 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.statinteger.PopulationVarianceIntegerTest.java
/** * Tests the plate statistics method.//from w ww .j a va 2s.c o m */ @Test public void testPlate() { for (PlateInteger plate : array) { Map<WellInteger, Double> resultMap = new TreeMap<WellInteger, Double>(); Map<WellInteger, Double> returnedMap = variance.plate(plate); for (WellInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getPopulationVariance(); 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.microflexbigdecimal.stat.SumTest.java
/** * Tests the plate statistics method./* w ww .ja va 2 s . co m*/ */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = sum.plate(plate, mc); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigDecimal bd : well) { input[index++] = bd.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getSum(); 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.github.jessemull.microflex.stat.statdouble.SampleStandardDeviationDoubleTest.java
/** * Tests the plate statistics method.// ww w. ja v a 2s. c o m */ @Test public void testPlate() { for (PlateDouble plate : array) { Map<WellDouble, Double> resultMap = new TreeMap<WellDouble, Double>(); Map<WellDouble, Double> returnedMap = deviation.plate(plate); for (WellDouble well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getStandardDeviation(); 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.microflexbigdecimal.stat.MeanTest.java
/** * Tests the plate statistics method.//from ww w . j av a 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 = mean.plate(plate, mc); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigDecimal bd : well) { input[index++] = bd.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getMean(); 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.github.jessemull.microflexdouble.stat.SampleVarianceWeightsTest.java
/** * Tests the plate statistics method.// w w w. j a v a 2 s .c o m */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, Double> resultMap = new TreeMap<Well, Double>(); Map<Well, Double> returnedMap = variance.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.getVariance(); 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.PercentileDoubleTest.java
/** * Tests the plate statistics method.// w ww .j av a 2 s . c o m */ @Test public void testPlate() { for (PlateDouble plate : array) { int inputPercentile = 1 + random.nextInt(100); Map<WellDouble, Double> resultMap = new TreeMap<WellDouble, Double>(); Map<WellDouble, Double> returnedMap = percentile.plate(plate, inputPercentile); for (WellDouble well : plate) { double[] input = new double[well.size()]; int index = 0; for (double db : well) { input[index++] = db; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getPercentile(inputPercentile); 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.StandardDeviationIntegerTest.java
/** * Tests the plate statistics method./*from w ww .ja va 2 s . co m*/ */ @Test public void testPlate() { for (PlateInteger plate : array) { Map<WellInteger, Double> resultMap = new TreeMap<WellInteger, Double>(); Map<WellInteger, Double> returnedMap = deviation.plate(plate); for (WellInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getStandardDeviation(); 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); } } }