Example usage for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getSkewness

List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getSkewness

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getSkewness.

Prototype

public double getSkewness() 

Source Link

Document

Returns the skewness of the available values.

Usage

From source file:com.github.jessemull.microflex.stat.statbigdecimal.SkewnessBigDecimalTest.java

/**
 * Tests the plate statistics method./*  www .  j  a  v a  2 s.  c o m*/
 */
@Test
public void testPlate() {

    for (PlateBigDecimal plate : array) {

        Map<WellBigDecimal, BigDecimal> resultMap = new TreeMap<WellBigDecimal, BigDecimal>();
        Map<WellBigDecimal, BigDecimal> returnedMap = skewness.plate(plate, mc);

        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.getSkewness();

            BigDecimal result = new BigDecimal(resultDouble);

            resultMap.put(well, result);
        }

        for (WellBigDecimal 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.microflexbigdecimal.stat.SkewnessTest.java

/**
 * Tests the plate statistics method.// ww w  .ja  va2s . c  om
 */
@Test
public void testPlate() {

    for (Plate plate : array) {

        Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>();
        Map<Well, BigDecimal> returnedMap = skewness.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.getSkewness();

            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.statbigdecimal.SkewnessBigDecimalTest.java

/**
 * Tests set calculation.//from  w w w.j  a  v a  2s.c o  m
 */
@Test
public void testSet() {

    for (PlateBigDecimal plate : array) {

        Map<WellBigDecimal, BigDecimal> resultMap = new TreeMap<WellBigDecimal, BigDecimal>();
        Map<WellBigDecimal, BigDecimal> returnedMap = skewness.set(plate.dataSet(), mc);

        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.getSkewness();

            BigDecimal result = new BigDecimal(resultDouble);

            resultMap.put(well, result);
        }

        for (WellBigDecimal 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.microflexbigdecimal.stat.SkewnessTest.java

/**
 * Tests set calculation.//  w ww  .  j av a 2s  .com
 */
@Test
public void testSet() {

    for (Plate plate : array) {

        Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>();
        Map<Well, BigDecimal> returnedMap = skewness.set(plate.dataSet(), 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.getSkewness();

            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.microflexbiginteger.stat.SkewnessTest.java

/**
 * Tests the plate statistics method./*from w  ww . j av a2s  .  c  o  m*/
 */
@Test
public void testPlate() {

    for (Plate plate : array) {

        Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>();
        Map<Well, BigDecimal> returnedMap = skewness.plate(plate, mc);

        for (Well well : plate) {

            double[] input = new double[well.size()];
            int index = 0;

            for (BigInteger bi : well) {
                input[index++] = bi.doubleValue();
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(input);
            double resultDouble = stat.getSkewness();

            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.statbiginteger.SkewnessBigIntegerTest.java

/**
 * Tests the plate statistics method.//from  w w w .j  av a  2 s  .c om
 */
@Test
public void testPlate() {

    for (PlateBigInteger plate : array) {

        Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>();
        Map<WellBigInteger, BigDecimal> returnedMap = skewness.plate(plate, mc);

        for (WellBigInteger well : plate) {

            double[] input = new double[well.size()];
            int index = 0;

            for (BigInteger bi : well) {
                input[index++] = bi.doubleValue();
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(input);
            double resultDouble = stat.getSkewness();

            BigDecimal result = new BigDecimal(resultDouble);

            resultMap.put(well, result);
        }

        for (WellBigInteger 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.microflexbiginteger.stat.SkewnessTest.java

/**
 * Tests set calculation./*from   w  w w. j  av a 2 s .  c  o  m*/
 */
@Test
public void testSet() {

    for (Plate plate : array) {

        Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>();
        Map<Well, BigDecimal> returnedMap = skewness.set(plate.dataSet(), mc);

        for (Well well : plate) {

            double[] input = new double[well.size()];
            int index = 0;

            for (BigInteger bi : well) {
                input[index++] = bi.doubleValue();
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(input);
            double resultDouble = stat.getSkewness();

            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.statbiginteger.SkewnessBigIntegerTest.java

/**
 * Tests set calculation.// w  w w.  j  a v a  2s.c o  m
 */
@Test
public void testSet() {

    for (PlateBigInteger plate : array) {

        Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>();
        Map<WellBigInteger, BigDecimal> returnedMap = skewness.set(plate.dataSet(), mc);

        for (WellBigInteger well : plate) {

            double[] input = new double[well.size()];
            int index = 0;

            for (BigInteger bi : well) {
                input[index++] = bi.doubleValue();
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(input);
            double resultDouble = stat.getSkewness();

            BigDecimal result = new BigDecimal(resultDouble);

            resultMap.put(well, result);
        }

        for (WellBigInteger 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.statbigdecimal.SkewnessBigDecimalTest.java

/**
 * Tests the aggregated plate statistics method.
 *///from w  ww  . j a v  a2 s.  c o m
@Test
public void testAggregatedPlate() {

    for (PlateBigDecimal plate : array) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();
        BigDecimal aggregatedReturned = skewness.platesAggregated(plate, mc);

        for (WellBigDecimal 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).doubleValue();
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregatedDouble = statAggregated.getSkewness();

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);

        BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned);
        assertEquals(corrected[0], corrected[1]);
    }
}

From source file:com.github.jessemull.microflex.stat.statbigdecimal.SkewnessBigDecimalTest.java

/**
 * Tests the aggregated plate statistics method.
 *///from w w w. ja va  2 s .  c  om
@Test
public void testAggregatedSet() {

    for (PlateBigDecimal plate : array) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();
        BigDecimal aggregatedReturned = skewness.setsAggregated(plate.dataSet(), mc);

        for (WellBigDecimal 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).doubleValue();
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregatedDouble = statAggregated.getSkewness();

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);

        BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned);
        assertEquals(corrected[0], corrected[1]);
    }
}