List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getGeometricMean
public double getGeometricMean()
From source file:com.intuit.tank.persistence.databases.BucketDataItemTest.java
/** * Run the DescriptiveStatistics getStats() method test. * //from ww w . j ava2 s.c o m * @throws Exception * * @generatedBy CodePro at 9/10/14 10:32 AM */ @Test public void testGetStats_1() throws Exception { BucketDataItem fixture = new BucketDataItem(1, new Date(), new DescriptiveStatistics()); DescriptiveStatistics result = fixture.getStats(); assertNotNull(result); assertEquals( "DescriptiveStatistics:\nn: 0\nmin: NaN\nmax: NaN\nmean: NaN\nstd dev: NaN\nmedian: NaN\nskewness: NaN\nkurtosis: NaN\n", result.toString()); assertEquals(Double.NaN, result.getMax(), 1.0); assertEquals(Double.NaN, result.getVariance(), 1.0); assertEquals(Double.NaN, result.getMean(), 1.0); assertEquals(-1, result.getWindowSize()); assertEquals(0.0, result.getSumsq(), 1.0); assertEquals(Double.NaN, result.getKurtosis(), 1.0); assertEquals(0.0, result.getSum(), 1.0); assertEquals(Double.NaN, result.getSkewness(), 1.0); assertEquals(Double.NaN, result.getPopulationVariance(), 1.0); assertEquals(Double.NaN, result.getStandardDeviation(), 1.0); assertEquals(Double.NaN, result.getGeometricMean(), 1.0); assertEquals(0L, result.getN()); assertEquals(Double.NaN, result.getMin(), 1.0); }
From source file:com.github.jessemull.microflex.stat.statinteger.GeometricMeanIntegerWeightsTest.java
/** * Tests the plate statistics method./* w ww . jav a 2 s.com*/ */ @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.getGeometricMean(); 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.GeometricMeanWeightsTest.java
/** * Tests the plate statistics method./* ww w. j a v a2s . 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.statdouble.GeometricMeanDoubleWeightsTest.java
/** * Tests the plate statistics method.//from ww w.jav 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 = 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.getGeometricMean(); 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.GeometricMeanIntegerWeightsTest.java
/** * Tests set calculation./* ww w . jav a2 s . c o m*/ */ @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.getGeometricMean(); 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.GeometricMeanWeightsTest.java
/** * Tests set calculation.//from w w w . j a v a 2s.co m */ @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.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.statdouble.GeometricMeanDoubleWeightsTest.java
/** * Tests set calculation.//from w ww. j a v a 2 s. c o 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.getGeometricMean(); 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.GeometricMeanIntegerWeightsTest.java
/** * Tests well calculation./* w ww . j av a2 s. co m*/ */ @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.getGeometricMean(), precision); double returned = Precision.round(mean.well(well, weights), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflexdouble.stat.GeometricMeanWeightsTest.java
/** * Tests well calculation./*www . ja v a 2 s . c om*/ */ @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.getGeometricMean(), precision); double returned = Precision.round(mean.well(well, weights), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statdouble.GeometricMeanDoubleWeightsTest.java
/** * Tests well calculation.//from www. j a v a 2 s .c o 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.getGeometricMean(), precision); double returned = Precision.round(mean.well(well, weights), precision); assertTrue(result == returned); } } }