Package org.apache.commons.math.stat

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


    public void testProductAndGeometricMean() throws Exception {
      StorelessDescriptiveStatisticsImpl u = new StorelessDescriptiveStatisticsImpl(10);
           
        u.addValue( 1.0 );
        u.addValue( 2.0 );
        u.addValue( 3.0 );
        u.addValue( 4.0 );

        assertEquals( "Geometric mean not expected", 2.213364,
            u.getGeometricMean(), 0.00001 );
View Full Code Here


      StorelessDescriptiveStatisticsImpl u = new StorelessDescriptiveStatisticsImpl(10);
           
        u.addValue( 1.0 );
        u.addValue( 2.0 );
        u.addValue( 3.0 );
        u.addValue( 4.0 );

        assertEquals( "Geometric mean not expected", 2.213364,
            u.getGeometricMean(), 0.00001 );

        // Now test rolling - StorelessDescriptiveStatistics should discount the contribution
View Full Code Here

            u.getGeometricMean(), 0.00001 );

        // Now test rolling - StorelessDescriptiveStatistics should discount the contribution
        // of a discarded element
        for( int i = 0; i < 10; i++ ) {
            u.addValue( i + 2 );
        }
        // Values should be (2,3,4,5,6,7,8,9,10,11)
       
        assertEquals( "Geometric mean not expected", 5.755931,
            u.getGeometricMean(), 0.00001 );
View Full Code Here

            u.getGeometricMean(), 0.00001 );
    }
   
    public void testRollingMinMax() {
        StorelessDescriptiveStatisticsImpl u = new StorelessDescriptiveStatisticsImpl(3);
        u.addValue( 1.0 );
        u.addValue( 5.0 );
        u.addValue( 3.0 );
        u.addValue( 4.0 ); // discarding min
        assertEquals( "min not expected", 3.0,
            u.getMin(), Double.MIN_VALUE);
View Full Code Here

    }
   
    public void testRollingMinMax() {
        StorelessDescriptiveStatisticsImpl u = new StorelessDescriptiveStatisticsImpl(3);
        u.addValue( 1.0 );
        u.addValue( 5.0 );
        u.addValue( 3.0 );
        u.addValue( 4.0 ); // discarding min
        assertEquals( "min not expected", 3.0,
            u.getMin(), Double.MIN_VALUE);
        u.addValue(1.0)// discarding max
View Full Code Here

   
    public void testRollingMinMax() {
        StorelessDescriptiveStatisticsImpl u = new StorelessDescriptiveStatisticsImpl(3);
        u.addValue( 1.0 );
        u.addValue( 5.0 );
        u.addValue( 3.0 );
        u.addValue( 4.0 ); // discarding min
        assertEquals( "min not expected", 3.0,
            u.getMin(), Double.MIN_VALUE);
        u.addValue(1.0)// discarding max
        assertEquals( "max not expected", 4.0,
View Full Code Here

    public void testRollingMinMax() {
        StorelessDescriptiveStatisticsImpl u = new StorelessDescriptiveStatisticsImpl(3);
        u.addValue( 1.0 );
        u.addValue( 5.0 );
        u.addValue( 3.0 );
        u.addValue( 4.0 ); // discarding min
        assertEquals( "min not expected", 3.0,
            u.getMin(), Double.MIN_VALUE);
        u.addValue(1.0)// discarding max
        assertEquals( "max not expected", 4.0,
            u.getMax(), Double.MIN_VALUE);
View Full Code Here

        u.addValue( 5.0 );
        u.addValue( 3.0 );
        u.addValue( 4.0 ); // discarding min
        assertEquals( "min not expected", 3.0,
            u.getMin(), Double.MIN_VALUE);
        u.addValue(1.0)// discarding max
        assertEquals( "max not expected", 4.0,
            u.getMax(), Double.MIN_VALUE);
    }
   
    public void testNaNContracts() {
View Full Code Here

        assertTrue("min not NaN",Double.isNaN(u.getMin()));
        assertTrue("std dev not NaN",Double.isNaN(u.getStandardDeviation()));
        assertTrue("var not NaN",Double.isNaN(u.getVariance()));
        assertTrue("geom mean not NaN",Double.isNaN(u.getGeometricMean()));
       
        u.addValue(1.0);
       
        assertEquals( "mean not expected", 1.0,
            u.getMean(), Double.MIN_VALUE);
        assertEquals( "variance not expected", 0.0,
            u.getVariance(), Double.MIN_VALUE);
View Full Code Here

        assertEquals( "variance not expected", 0.0,
            u.getVariance(), Double.MIN_VALUE);
        assertEquals( "geometric mean not expected", 1.0,
            u.getGeometricMean(), Double.MIN_VALUE);
       
        u.addValue(-1.0);
       
        assertTrue("geom mean not NaN",Double.isNaN(u.getGeometricMean()));
       
        u.addValue(0.0);
       
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.