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

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

Introduction

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

Prototype

public DescriptiveStatistics(DescriptiveStatistics original) throws NullArgumentException 

Source Link

Document

Copy constructor.

Usage

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

/**
 * Tests the plate statistics method using the values between the indices.
 */// w w  w  .  j  a  v a  2  s. co  m
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = min.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            double result = stat.getMin();

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

/**
 * Tests the plate statistics method using the values between the indices.
 *//*w  ww .j a v a 2s.com*/
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = sum.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            double result = stat.getSum();

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

/**
 * Tests the plate statistics method using the values between the indices.
 *//*from   ww w .j  a v a 2 s  . com*/
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = mean.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            double result = stat.getMean();

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

/**
 * Tests the plate statistics method using the values between the indices.
 *///from   w w w  .j  ava  2s  .  co  m
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = mean.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            double result = stat.getSkewness();

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

/**
 * Tests the plate statistics method using the values between the indices.
 *//*from  ww  w .ja  v  a 2  s.c om*/
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = kurtosis.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            double result = stat.getKurtosis();

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

/**
 * Tests the plate statistics method using the values between the indices.
 *//*from  ww  w.java  2 s . c  om*/
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = sum.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            double result = stat.getSumsq();

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

/**
 * Tests the plate statistics method using the values between the indices.
 *//* www  .j  a va 2s  . c o m*/
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = mean.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            double result = stat.getGeometricMean();

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

/**
 * Tests the plate statistics method using the values between the indices.
 *//*w  w  w .  j  a  v  a  2s. co m*/
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = variance.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            double result = stat.getVariance();

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

/**
 * Tests the plate statistics method using the values between the indices.
 *///from  w  w w .  ja  va2 s.  c  o  m
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = variance.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            double result = stat.getPopulationVariance();

            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 the plate statistics method using the values between the indices.
 *//*from w  w w.  j a va2 s.c o  m*/
@Test
public void testPlateIndices() {

    for (Plate plate : arrayIndices) {

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

        Map<Well, Double> resultMap = new TreeMap<Well, Double>();
        Map<Well, Double> returnedMap = deviation.plate(plate, begin, end - begin);

        for (Well well : plate) {

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

            for (double bd : well) {
                input[index++] = bd;
                ;
            }

            DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end));
            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);
        }
    }
}