List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getPopulationVariance
public double getPopulationVariance()
From source file:com.github.aptd.simulation.core.statistic.local.CStatistic.java
/** * write data//from ww w . j a v a 2 s .c om * * @param p_writer writer instance * @param p_name section name * @param p_statistic statistic value */ private static void apply(final IWriter p_writer, final String p_name, final DescriptiveStatistics p_statistic) { p_writer.section(1, p_name); p_writer.value("geometricmean", p_statistic.getGeometricMean()); p_writer.value("kurtosis", p_statistic.getKurtosis()); p_writer.value("max", p_statistic.getMax()); p_writer.value("min", p_statistic.getMin()); p_writer.value("mean", p_statistic.getMean()); p_writer.value("count", p_statistic.getN()); p_writer.value("25-percentile", p_statistic.getPercentile(0.25)); p_writer.value("75-percentile", p_statistic.getPercentile(0.75)); p_writer.value("populationvariance", p_statistic.getPopulationVariance()); p_writer.value("quadraticmean", p_statistic.getQuadraticMean()); p_writer.value("standdeviation", p_statistic.getStandardDeviation()); p_writer.value("skewness", p_statistic.getSkewness()); p_writer.value("sum", p_statistic.getSum()); p_writer.value("sumsequared", p_statistic.getSumsq()); p_writer.value("variance", p_statistic.getVariance()); }
From source file:gr.iti.mklab.reveal.forensics.util.Util.java
public static double[][] blockVar(double[][] inputIm, int blockSize) { // block variance of input int image int blockedWidth = (int) Math.floor(inputIm.length / blockSize) * blockSize; int blockedHeight = (int) Math.floor(inputIm[0].length / blockSize) * blockSize; double[][] blockedIm = new double[blockedWidth / blockSize][blockedHeight / blockSize]; DescriptiveStatistics blockValues; for (int ii = 0; ii < blockedWidth; ii = ii + blockSize) { for (int jj = 0; jj < blockedHeight; jj = jj + blockSize) { blockValues = new DescriptiveStatistics(); for (int B_ii = ii; B_ii < ii + blockSize; B_ii++) { for (int B_jj = jj; B_jj < jj + blockSize; B_jj++) { blockValues.addValue(Math.abs(inputIm[B_ii][B_jj])); }/*from w w w .j ava 2 s . co m*/ } blockedIm[ii / blockSize][jj / blockSize] = blockValues.getPopulationVariance(); } } return blockedIm; }
From source file:com.duy.pascal.interperter.libraries.math.MathLib.java
@PascalMethod(description = "") public double PopNVariance(double... arr) { DescriptiveStatistics descriptiveStatistics1 = new DescriptiveStatistics(arr); return descriptiveStatistics1.getPopulationVariance(); }
From source file:com.duy.pascal.interperter.libraries.math.MathLib.java
@PascalMethod(description = "") public double Popstddev(double... arr) { DescriptiveStatistics descriptiveStatistics1 = new DescriptiveStatistics(arr); return descriptiveStatistics1.getPopulationVariance(); }
From source file:com.intuit.tank.persistence.databases.BucketDataItemTest.java
/** * Run the DescriptiveStatistics getStats() method test. * /*from www .j av a2 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.microflexdouble.stat.PopulationVarianceTest.java
/** * Tests the plate statistics method./*w w w . j a v a2s .c om*/ */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, Double> resultMap = new TreeMap<Well, Double>(); Map<Well, Double> returnedMap = variance.plate(plate); for (Well 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 (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.PopulationVarianceTest.java
/** * Tests set calculation.//from ww w . j av a2 s .co m */ @Test public void testSet() { for (Plate plate : array) { Map<Well, Double> resultMap = new TreeMap<Well, Double>(); Map<Well, Double> returnedMap = variance.set(plate.dataSet()); for (Well 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 (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./* www . ja v a 2s. co 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.microflex.stat.statdouble.PopulationVarianceDoubleTest.java
/** * Tests the plate statistics method./* w w w .ja v a 2 s . com*/ */ @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.microflex.stat.statinteger.PopulationVarianceIntegerTest.java
/** * Tests set calculation./*from w w w . j a v a2s.c o m*/ */ @Test public void testSet() { for (PlateInteger plate : array) { Map<WellInteger, Double> resultMap = new TreeMap<WellInteger, Double>(); Map<WellInteger, Double> returnedMap = variance.set(plate.dataSet()); 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); } } }