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.SumOfSquaresIntegerWeightsTest.java
/** * Tests the plate statistics method.//ww w . j av a 2s . co m */ @Test public void testPlate() { for (PlateInteger plate : array) { Map<WellInteger, Double> resultMap = new TreeMap<WellInteger, Double>(); Map<WellInteger, Double> returnedMap = sum.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.getSumsq(); 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.SumOfSquaresWeightsTest.java
/** * Tests set calculation.// w ww .j a v a 2 s .c o m */ @Test public void testSet() { for (Plate plate : array) { Map<Well, Double> resultMap = new TreeMap<Well, Double>(); Map<Well, Double> returnedMap = sum.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.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.microflex.stat.statdouble.SumOfSquaresDoubleWeightsTest.java
/** * Tests set calculation./*from ww w .j a v 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 = sum.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.getSumsq(); 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.SumOfSquaresIntegerWeightsTest.java
/** * Tests set calculation.//from w ww . j av a 2s. c o m */ @Test public void testSet() { for (PlateInteger plate : array) { Map<WellInteger, Double> resultMap = new TreeMap<WellInteger, Double>(); Map<WellInteger, Double> returnedMap = sum.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.getSumsq(); 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.SumOfSquaresWeightsTest.java
/** * Tests well calculation.//from w w w . ja v a2 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.getSumsq(), precision); double returned = Precision.round(sum.well(well, weights), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statdouble.SumOfSquaresDoubleWeightsTest.java
/** * Tests well calculation./*from www .j a v a 2s. c om*/ */ @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.getSumsq(), precision); double returned = Precision.round(sum.well(well, weights), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statinteger.SumOfSquaresIntegerWeightsTest.java
/** * Tests well calculation./*from w w w.j a v a 2s. c o 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.getSumsq(), precision); double returned = Precision.round(sum.well(well, weights), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SumOfSquaresTest.java
/** * Tests well calculation.// w w w . j a v a2 s . com */ @Test public void testWell() { for (Plate plate : array) { 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.getSumsq(); BigDecimal returned = sum.well(well, mc); BigDecimal result = new BigDecimal(resultDouble); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.SumOfSquaresBigDecimalTest.java
/** * Tests well calculation.//from ww w . j av a 2 s . co m */ @Test public void testWell() { for (PlateBigDecimal plate : array) { for (WellBigDecimal 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.getSumsq(); BigDecimal returned = sum.well(well, mc); BigDecimal result = new BigDecimal(resultDouble); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbigdecimal.stat.SumOfSquaresTest.java
/** * Tests the plate statistics method./*from w w w . j a v a2 s . c om*/ */ @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.getSumsq(); 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]); } } }