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

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

Introduction

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

Prototype

public double getStandardDeviation() 

Source Link

Document

Returns the standard deviation of the available values.

Usage

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

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

    for (Plate plate : array) {

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = deviation.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.getStandardDeviation();

            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.SampleStandardDeviationTest.java

/**
 * Tests set calculation./*from  w  w  w . ja  v  a2s .com*/
 */
@Test
public void testSet() {

    for (Plate plate : array) {

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = deviation.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.getStandardDeviation();

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

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

    for (PlateDouble plate : array) {

        Map<WellDouble, Double> resultMap = new TreeMap<WellDouble, Double>();
        Map<WellDouble, Double> returnedMap = deviation.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.getStandardDeviation();

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

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

    for (PlateDouble plate : array) {

        Map<WellDouble, Double> resultMap = new TreeMap<WellDouble, Double>();
        Map<WellDouble, Double> returnedMap = deviation.set(plate.dataSet());

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

            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.StandardDeviationIntegerTest.java

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

    for (PlateInteger plate : array) {

        Map<WellInteger, Double> resultMap = new TreeMap<WellInteger, Double>();
        Map<WellInteger, Double> returnedMap = deviation.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.getStandardDeviation();

            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.statinteger.StandardDeviationIntegerTest.java

/**
 * Tests set calculation./*from  w w  w  . ja va2  s .  c  om*/
 */
@Test
public void testSet() {

    for (PlateInteger plate : array) {

        Map<WellInteger, Double> resultMap = new TreeMap<WellInteger, Double>();
        Map<WellInteger, Double> returnedMap = deviation.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.getStandardDeviation();

            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.microflexdouble.stat.SampleStandardDeviationTest.java

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

    for (Plate plate : array) {

        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 = Precision.round(stat.getStandardDeviation(), precision);
            double returned = Precision.round(deviation.well(well), precision);

            assertTrue(result == returned);
        }
    }
}

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

/**
 * Tests well calculation.//www . j a v a  2s .  c o  m
 */
@Test
public void testWell() {

    for (PlateDouble plate : array) {

        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 = Precision.round(stat.getStandardDeviation(), precision);
            double returned = Precision.round(deviation.well(well), precision);

            assertTrue(result == returned);
        }
    }
}

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

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

    for (PlateInteger plate : array) {

        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 = Precision.round(stat.getStandardDeviation(), precision);
            double returned = Precision.round(deviation.well(well), precision);

            assertTrue(result == returned);
        }
    }
}

From source file:com.github.jessemull.microflexinteger.stat.StandardDeviationTest.java

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

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

    for (Plate plate : collection) {

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

        for (Well 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 aggregatedResult = statAggregated.getStandardDeviation();

        aggregatedResultMap.put(plate, aggregatedResult);
    }

    for (Plate plate : collection) {

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

        assertTrue(result == returned);
    }
}