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

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

Introduction

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

Prototype

public double getKurtosis() 

Source Link

Document

Returns the Kurtosis of the available values.

Usage

From source file:com.github.jessemull.microflexbigdecimal.stat.KurtosisTest.java

/**
 * Tests the aggregated plate statistics method using a collection.
 *///w  w w  . j  a  va2s .  co m
@Test
public void testAggregatedPlateCollection() {

    List<Plate> collection = Arrays.asList(array);
    Map<Plate, BigDecimal> aggregatedReturnedMap = kurtosis.platesAggregated(collection, mc);
    Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>();

    for (Plate plate : collection) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (Well 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.getKurtosis();

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);
        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (Plate plate : collection) {

        BigDecimal result = aggregatedResultMap.get(plate);
        BigDecimal returned = aggregatedReturnedMap.get(plate);

        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }
}

From source file:com.github.jessemull.microflexbigdecimal.stat.KurtosisTest.java

/**
 * Tests the aggregated plate statistics method using an array.
 *///w w  w.ja  v  a  2s .  co m
@Test
public void testAggregatedPlateArray() {

    Map<Plate, BigDecimal> aggregatedReturnedMap = kurtosis.platesAggregated(array, mc);
    Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>();

    for (Plate plate : array) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (Well 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.getKurtosis();

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);
        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (Plate plate : array) {

        BigDecimal result = aggregatedResultMap.get(plate);
        BigDecimal returned = aggregatedReturnedMap.get(plate);

        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }

}

From source file:com.github.jessemull.microflexbiginteger.stat.KurtosisTest.java

/**
 * Tests the aggregated plate statistics method using a collection.
 *///  w  w w.j  a  v  a 2  s .  c  o  m
@Test
public void testAggregatedPlateCollection() {

    List<Plate> collection = Arrays.asList(array);
    Map<Plate, BigDecimal> aggregatedReturnedMap = kurtosis.platesAggregated(collection, mc);
    Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>();

    for (Plate plate : collection) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (Well well : plate) {
            resultList.addAll(well.toBigDecimal());
        }

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

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);
        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (Plate plate : collection) {

        BigDecimal result = aggregatedResultMap.get(plate);
        BigDecimal returned = aggregatedReturnedMap.get(plate);

        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }
}

From source file:com.github.jessemull.microflexbiginteger.stat.KurtosisTest.java

/**
 * Tests the aggregated plate statistics method using an array.
 *///from   w w w.j  av a2 s  . co m
@Test
public void testAggregatedPlateArray() {

    Map<Plate, BigDecimal> aggregatedReturnedMap = kurtosis.platesAggregated(array, mc);
    Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>();

    for (Plate plate : array) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (Well well : plate) {
            resultList.addAll(well.toBigDecimal());
        }

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

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);
        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (Plate plate : array) {

        BigDecimal result = aggregatedResultMap.get(plate);
        BigDecimal returned = aggregatedReturnedMap.get(plate);

        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }

}

From source file:com.github.jessemull.microflex.stat.statbiginteger.KurtosisBigIntegerTest.java

/**
 * Tests the aggregated plate statistics method using a collection.
 *//*from   w ww  . j  ava 2 s .co  m*/
@Test
public void testAggregatedPlateCollection() {

    List<PlateBigInteger> collection = Arrays.asList(array);
    Map<PlateBigInteger, BigDecimal> aggregatedReturnedMap = kurtosis.platesAggregated(collection, mc);
    Map<PlateBigInteger, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigInteger, BigDecimal>();

    for (PlateBigInteger plate : collection) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (WellBigInteger well : plate) {
            resultList.addAll(well.toBigDecimal());
        }

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

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);
        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (PlateBigInteger plate : collection) {

        BigDecimal result = aggregatedResultMap.get(plate);
        BigDecimal returned = aggregatedReturnedMap.get(plate);

        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }
}

From source file:com.github.jessemull.microflex.stat.statbiginteger.KurtosisBigIntegerTest.java

/**
 * Tests the aggregated plate statistics method using an array.
 *//*w  ww  .  j  a  v a  2s .  com*/
@Test
public void testAggregatedPlateArray() {

    Map<PlateBigInteger, BigDecimal> aggregatedReturnedMap = kurtosis.platesAggregated(array, mc);
    Map<PlateBigInteger, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigInteger, BigDecimal>();

    for (PlateBigInteger plate : array) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (WellBigInteger well : plate) {
            resultList.addAll(well.toBigDecimal());
        }

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

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);
        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (PlateBigInteger plate : array) {

        BigDecimal result = aggregatedResultMap.get(plate);
        BigDecimal returned = aggregatedReturnedMap.get(plate);

        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }

}

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

/**
 * Tests the aggregated plate statistics method using the values between the indices of
 * the array./*from   w ww.  j a v  a2  s  .  c  o  m*/
 */
@Test
public void testAggregatedPlateArrayIndices() {

    int size = arrayIndices[0].first().size();
    int begin = random.nextInt(size - 5);
    int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1);

    Map<PlateBigDecimal, BigDecimal> aggregatedReturnedMap = kurtosis.platesAggregated(arrayIndices, begin,
            end - begin, mc);
    Map<PlateBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigDecimal, BigDecimal>();

    for (PlateBigDecimal plate : arrayIndices) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (WellBigDecimal well : plate) {
            resultList.addAll(well.data().subList(begin, end));
        }

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

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);

        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (PlateBigDecimal plate : arrayIndices) {

        BigDecimal result = aggregatedResultMap.get(plate);
        BigDecimal returned = aggregatedReturnedMap.get(plate);
        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }
}

From source file:com.github.jessemull.microflexbigdecimal.stat.KurtosisTest.java

/**
 * Tests the aggregated plate statistics method using the values between the indices of
 * the array./*from w ww.j av  a  2s .  c  o  m*/
 */
@Test
public void testAggregatedPlateArrayIndices() {

    int size = arrayIndices[0].first().size();
    int begin = random.nextInt(size - 5);
    int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1);

    Map<Plate, BigDecimal> aggregatedReturnedMap = kurtosis.platesAggregated(arrayIndices, begin, end - begin,
            mc);
    Map<Plate, BigDecimal> aggregatedResultMap = new TreeMap<Plate, BigDecimal>();

    for (Plate plate : arrayIndices) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (Well well : plate) {
            resultList.addAll(well.data().subList(begin, end));
        }

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

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);

        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (Plate plate : arrayIndices) {

        BigDecimal result = aggregatedResultMap.get(plate);
        BigDecimal returned = aggregatedReturnedMap.get(plate);
        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }
}

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

/**
 * Tests the aggregated plate statistics method using the values between the indices of
 * the collection./*from www .  j a v  a  2  s  .c  om*/
 */
@Test
public void testAggregatedPlateCollectionIndices() {

    int size = arrayIndices[0].first().size();
    int begin = random.nextInt(size - 5);
    int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1);

    List<PlateBigDecimal> collection = Arrays.asList(arrayIndices);
    Map<PlateBigDecimal, BigDecimal> aggregatedReturnedMap = kurtosis.platesAggregated(collection, begin,
            end - begin, mc);

    Map<PlateBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigDecimal, BigDecimal>();

    for (PlateBigDecimal plate : collection) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (WellBigDecimal well : plate) {
            resultList.addAll(well.data().subList(begin, end));
        }

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

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);
        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (PlateBigDecimal plate : collection) {

        BigDecimal result = aggregatedResultMap.get(plate);
        BigDecimal returned = aggregatedReturnedMap.get(plate);
        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }
}

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

/**
 * Tests the aggregated plate statistics method using a collection.
 *//*w ww .  j a va 2 s .  co  m*/
@Test
public void testAggregatedSetCollection() {

    List<WellSetBigDecimal> collection = new ArrayList<WellSetBigDecimal>();

    for (PlateBigDecimal plate : array) {
        collection.add(plate.dataSet());
    }

    Map<WellSetBigDecimal, BigDecimal> aggregatedReturnedMap = kurtosis.setsAggregated(collection, mc);
    Map<WellSetBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<WellSetBigDecimal, BigDecimal>();

    for (WellSetBigDecimal set : collection) {

        List<BigDecimal> resultList = new ArrayList<BigDecimal>();

        for (WellBigDecimal well : set) {
            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.getKurtosis();

        BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble);
        aggregatedResultMap.put(set, aggregatedResult);
    }

    for (WellSetBigDecimal set : collection) {

        BigDecimal result = aggregatedResultMap.get(set);
        BigDecimal returned = aggregatedReturnedMap.get(set);

        BigDecimal[] corrected = correctRoundingErrors(result, returned);

        assertEquals(corrected[0], corrected[1]);
    }
}