Package org.apache.commons.math.stat

Examples of org.apache.commons.math.stat.DescriptiveStatistics.addValue()


       
        double[] testArray =
        { 12.5, 12, 11.8, 14.2, 14.9, 14.5, 21, 8.2, 10.3, 11.3, 14.1,
          9.9, 12.2, 12, 12.1, 11, 19.8, 11, 10, 8.8, 9, 12.3 };
        for( int i = 0; i < testArray.length; i++) {
            u.addValue( testArray[i]);
        }
       
        assertEquals("mean", 12.40455, u.getMean(), 0.0001);
        assertEquals("variance", 10.00236, u.getVariance(), 0.0001);
        assertEquals("skewness", 1.437424, u.getSkewness(), 0.0001);
View Full Code Here


                    throw new RuntimeException("bin alignment error");
                }
                if (val <= binUpperBounds[i]) {
                    found = true;
                    DescriptiveStatistics stats = (DescriptiveStatistics)binStats.get(i);
                    stats.addValue(val);
                }
                i++;
            }
        }
        in.close();
View Full Code Here

        assertTrue("empirical distribution property",
            vs.getEmpiricalDistribution() != null);
        DescriptiveStatistics stats = new StorelessDescriptiveStatisticsImpl();
        for (int i = 1; i < 1000; i++) {
            next = vs.getNext();
            stats.addValue(next);
        }   
        assertEquals("mean", 5.069831575018909, stats.getMean(), tolerance);
        assertEquals
         ("std dev", 1.0173699343977738, stats.getStandardDeviation(),
            tolerance);
View Full Code Here

       
        vs.computeDistribution(500);
        stats = new StorelessDescriptiveStatisticsImpl();
        for (int i = 1; i < 1000; i++) {
            next = vs.getNext();
            stats.addValue(next);
        }   
        assertEquals("mean", 5.069831575018909, stats.getMean(), tolerance);
        assertEquals
         ("std dev", 1.0173699343977738, stats.getStandardDeviation(),
            tolerance);
View Full Code Here

   
    private void tstGen(double tolerance)throws Exception {
        empiricalDistribution.load(file);  
        DescriptiveStatistics stats = new StorelessDescriptiveStatisticsImpl();
        for (int i = 1; i < 1000; i++) {
            stats.addValue(empiricalDistribution.getNextValue());
        }
        //TODO: replace these with statistical tests -- refactor as necessary
        assertEquals("mean", stats.getMean(),5.069831575018909,tolerance);
        assertEquals
         ("std dev", stats.getStandardDeviation(),1.0173699343977738,tolerance);
View Full Code Here

        } catch (IllegalArgumentException ex) {
            ;
        }
        DescriptiveStatistics u = new StorelessDescriptiveStatisticsImpl();
        for (int i = 0; i<largeSampleSize; i++) {
            u.addValue(randomData.nextGaussian(0,1));
        }
        double xbar = u.getMean();
        double s = u.getStandardDeviation();
        double n = (double) u.getN();
        /* t-test at .001-level TODO: replace with externalized t-test, with
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.