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:performancestatisticsasset.DistributionSet.java

public void setDistributionSet(String targetTask, String targetMeasure, RecordList dataSet) {
    //Determine the number of trials selected by task
    int trials = 0;
    int len = dataSet.records.size();
    for (int i = 0; i < len; i++) {
        if (dataSet.records.get(i).getTrialNumber() > trials)
            trials = dataSet.records.get(i).getTrialNumber();
    }//from   w  w w  .  j a  v a2s . com

    Distribution tempDist;
    DescriptiveStatistics tempStat;
    //For each trial of the set do
    for (int i = 0; i < trials; i++) {
        tempDist = new Distribution();
        tempStat = new DescriptiveStatistics();
        //Select data
        for (int j = 0; j < len; j++) {
            //If the current record is of the correct trial
            if ((dataSet.records.get(j).getTrialNumber() == i + 1)
                    && (targetTask.equals(dataSet.records.get(j).getTaskID()))) {
                //Fill distribution
                switch (targetMeasure) {
                case "time":
                    tempStat.addValue(dataSet.records.get(j).getTimeToComplete());
                    break;
                case "perf":
                    tempStat.addValue(dataSet.records.get(j).getPerformance());
                    break;
                }
            }
        }
        //Transfer the computed statistics to tempDist
        tempDist.max = tempStat.getMax();
        tempDist.min = tempStat.getMin();
        tempDist.sum = tempStat.getSum();
        tempDist.variance = tempStat.getVariance();
        tempDist.mean = tempStat.getMean();
        tempDist.stdDev = tempStat.getStandardDeviation();
        tempDist.skewness = tempStat.getSkewness();
        tempDist.kurtosis = tempStat.getKurtosis();
        tempDist.n = tempStat.getN();

        //Add tempDist to distributionSet
        distributionSet.add(tempDist);
    }
}