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.statdouble.SkewnessDoubleTest.java

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

    for (PlateDouble plate : array) {

        List<Double> resultList = new ArrayList<Double>();
        double aggregatedReturned = Precision.round(mean.platesAggregated(plate), precision);

        for (WellDouble 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);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = Precision.round(statAggregated.getSkewness(), precision);

        assertTrue(resultAggregated == aggregatedReturned);
    }
}

From source file:com.github.jessemull.microflex.stat.statdouble.SkewnessDoubleTest.java

/**
 * Tests the aggregated plate statistics method using the values between the indices of
 * the collection./*w  ww. ja v a 2  s. c o m*/
 */
@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<PlateDouble> collection = Arrays.asList(arrayIndices);
    Map<PlateDouble, Double> aggregatedReturnedMap = mean.platesAggregated(collection, begin, end - begin);

    Map<PlateDouble, Double> aggregatedResultMap = new TreeMap<PlateDouble, Double>();

    for (PlateDouble plate : collection) {

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

        for (WellDouble 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);
        }

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

        aggregatedResultMap.put(plate, resultAggregated);
    }

    for (PlateDouble plate : collection) {

        double result = Precision.round(aggregatedResultMap.get(plate), precision);
        double returned = Precision.round(aggregatedReturnedMap.get(plate), precision);

        assertTrue(result == returned);
    }
}

From source file:com.github.jessemull.microflex.stat.statdouble.SkewnessDoubleTest.java

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

    for (PlateDouble plate : array) {

        List<Double> resultList = new ArrayList<Double>();
        double aggregatedReturned = Precision.round(mean.setsAggregated(plate.dataSet()), precision);

        for (WellDouble 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);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = Precision.round(statAggregated.getSkewness(), precision);

        assertTrue(resultAggregated == aggregatedReturned);
    }
}

From source file:com.github.jessemull.microflex.stat.statdouble.SkewnessDoubleTest.java

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

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

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

    Map<WellSetDouble, Double> aggregatedReturnedMap = mean.setsAggregated(collection);
    Map<WellSetDouble, Double> aggregatedResultMap = new TreeMap<WellSetDouble, Double>();

    for (WellSetDouble set : collection) {

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

        for (WellDouble 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);
        }

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

        aggregatedResultMap.put(set, aggregatedResult);
    }

    for (WellSetDouble set : collection) {

        double result = Precision.round(aggregatedResultMap.get(set), precision);
        double returned = Precision.round(aggregatedReturnedMap.get(set), precision);

        assertTrue(result == returned);
    }
}

From source file:com.github.jessemull.microflex.stat.statinteger.SkewnessIntegerTest.java

/**
 * Tests the aggregated plate statistics method.
 *//*from w w  w  . j a va2 s.c  om*/
@Test
public void testAggregatedPlate() {

    for (PlateInteger plate : array) {

        List<Double> resultList = new ArrayList<Double>();
        double aggregatedReturned = Precision.round(mean.platesAggregated(plate), precision);

        for (WellInteger well : plate) {
            resultList.addAll(well.toDouble());
        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = Precision.round(statAggregated.getSkewness(), precision);

        assertTrue(resultAggregated == aggregatedReturned);
    }
}

From source file:com.github.jessemull.microflex.stat.statinteger.SkewnessIntegerTest.java

/**
 * Tests the aggregated plate statistics method using the values between the indices of
 * the collection./*from ww w.ja va2  s .c o  m*/
 */
@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<PlateInteger> collection = Arrays.asList(arrayIndices);
    Map<PlateInteger, Double> aggregatedReturnedMap = mean.platesAggregated(collection, begin, end - begin);

    Map<PlateInteger, Double> aggregatedResultMap = new TreeMap<PlateInteger, Double>();

    for (PlateInteger plate : collection) {

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

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

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

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

        aggregatedResultMap.put(plate, resultAggregated);
    }

    for (PlateInteger plate : collection) {

        double result = Precision.round(aggregatedResultMap.get(plate), precision);
        double returned = Precision.round(aggregatedReturnedMap.get(plate), precision);

        assertTrue(result == returned);
    }
}

From source file:com.github.jessemull.microflex.stat.statinteger.SkewnessIntegerTest.java

/**
 * Tests the aggregated plate statistics method.
 *//*  w ww  .j av  a 2 s  . c o  m*/
@Test
public void testAggregatedSet() {

    for (PlateInteger plate : array) {

        List<Double> resultList = new ArrayList<Double>();
        double aggregatedReturned = Precision.round(mean.setsAggregated(plate.dataSet()), precision);

        for (WellInteger well : plate) {
            resultList.addAll(well.toDouble());
        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = Precision.round(statAggregated.getSkewness(), precision);

        assertTrue(resultAggregated == aggregatedReturned);
    }
}

From source file:com.github.jessemull.microflex.stat.statinteger.SkewnessIntegerTest.java

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

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

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

    Map<WellSetInteger, Double> aggregatedReturnedMap = mean.setsAggregated(collection);
    Map<WellSetInteger, Double> aggregatedResultMap = new TreeMap<WellSetInteger, Double>();

    for (WellSetInteger set : collection) {

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

        for (WellInteger well : set) {
            resultList.addAll(well.toDouble());
        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

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

        aggregatedResultMap.put(set, aggregatedResult);
    }

    for (WellSetInteger set : collection) {

        double result = Precision.round(aggregatedResultMap.get(set), precision);
        double returned = Precision.round(aggregatedReturnedMap.get(set), precision);

        assertTrue(result == returned);
    }
}

From source file:com.github.jessemull.microflexdouble.stat.SkewnessTest.java

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

    WellSet[] setArray = new WellSet[array.length];

    for (int i = 0; i < setArray.length; i++) {
        setArray[i] = array[i].dataSet();
    }

    Map<WellSet, Double> aggregatedReturnedMap = mean.setsAggregated(setArray);
    Map<WellSet, Double> aggregatedResultMap = new TreeMap<WellSet, Double>();

    for (WellSet set : setArray) {

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

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

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

        aggregatedResultMap.put(set, aggregatedResult);
    }

    for (WellSet set : setArray) {

        double result = Precision.round(aggregatedResultMap.get(set), precision);
        double returned = Precision.round(aggregatedReturnedMap.get(set), precision);

        assertTrue(result == returned);
    }

}

From source file:com.github.jessemull.microflex.stat.statdouble.SkewnessDoubleTest.java

/**
 * Tests the aggregated plate statistics method using an array.
 *//*from www  .j  a  v a2 s . co m*/
@Test
public void testAggregatedSetArray() {

    WellSetDouble[] setArray = new WellSetDouble[array.length];

    for (int i = 0; i < setArray.length; i++) {
        setArray[i] = array[i].dataSet();
    }

    Map<WellSetDouble, Double> aggregatedReturnedMap = mean.setsAggregated(setArray);
    Map<WellSetDouble, Double> aggregatedResultMap = new TreeMap<WellSetDouble, Double>();

    for (WellSetDouble set : setArray) {

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

        for (WellDouble 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);
        }

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

        aggregatedResultMap.put(set, aggregatedResult);
    }

    for (WellSetDouble set : setArray) {

        double result = Precision.round(aggregatedResultMap.get(set), precision);
        double returned = Precision.round(aggregatedReturnedMap.get(set), precision);

        assertTrue(result == returned);
    }

}