Package org.apache.commons.math.stat.descriptive

Examples of org.apache.commons.math.stat.descriptive.SummaryStatistics.addValue()


            final long durationValue = min + random.nextInt(max - min);
            final int callCountValue = min + random.nextInt(max - min);
            final int peakRecursionDepthValue = min + random.nextInt(max - min);
            durationStats.addValue(durationValue);
            servletCallCountStats.addValue(callCountValue);
            peakRecursionDepthStats.addValue(peakRecursionDepthValue);
           
            final RequestData requestData = context.mock(RequestData.class, "requestData" + i);
            context.checking(new Expectations() {{
                one(requestData).getElapsedTimeMsec();
                will(returnValue(durationValue));
View Full Code Here


        while (line != null) {
            if (d != null) {
                d.addValue(Double.parseDouble(line.trim()));
            else {
                s.addValue(Double.parseDouble(line.trim()));
            }
            line = in.readLine();
        }

        in.close();
View Full Code Here

        } catch (IllegalArgumentException ex) {
            // ignored
        }
        SummaryStatistics u = new SummaryStatistics();
        for (int i = 0; i < largeSampleSize; i++) {
            u.addValue(randomData.nextGaussian(0, 1));
        }
        double xbar = u.getMean();
        double s = u.getStandardDeviation();
        double n = u.getN();
        /*
 
View Full Code Here

    @Test
    public void testGaussian() {
        MersenneTwister mt = new MersenneTwister(42853252100l);
        SummaryStatistics sample = new SummaryStatistics();
        for (int i = 0; i < 1000; ++i) {
            sample.addValue(mt.nextGaussian());
        }
        assertEquals(0.0, sample.getMean(), 0.005);
        assertEquals(1.0, sample.getStandardDeviation(), 0.025);
    }
View Full Code Here

    @Test
    public void testDouble() {
        MersenneTwister mt = new MersenneTwister(195357343514l);
        SummaryStatistics sample = new SummaryStatistics();
        for (int i = 0; i < 1000; ++i) {
            sample.addValue(mt.nextDouble());
        }
        assertEquals(0.5, sample.getMean(), 0.02);
        assertEquals(1.0 / (2.0 * Math.sqrt(3.0)),
                     sample.getStandardDeviation(),
                     0.002);
View Full Code Here

            integ.integrate(brusselator, 0, y, 20.0, y);
            double[] yP = { 1.3, b + hP };
            brusselator.setParameter(0, b + hP);
            integ.integrate(brusselator, 0, yP, 20.0, yP);
            residualsP0.addValue((yP[0] - y[0]) / hP - brusselator.dYdP0());
            residualsP1.addValue((yP[1] - y[1]) / hP - brusselator.dYdP1());
        }
        Assert.assertTrue((residualsP0.getMax() - residualsP0.getMin()) > 600);
        Assert.assertTrue(residualsP0.getStandardDeviation() > 30);
        Assert.assertTrue((residualsP1.getMax() - residualsP1.getMin()) > 800);
        Assert.assertTrue(residualsP1.getStandardDeviation() > 50);
View Full Code Here

            integ.integrate(brusselator, 0, y, 20.0, y);
            double[] yP = { 1.3, b + hP };
            brusselator.setParameter(0, b + hP);
            integ.integrate(brusselator, 0, yP, 20.0, yP);
            residualsP0.addValue((yP[0] - y[0]) / hP - brusselator.dYdP0());
            residualsP1.addValue((yP[1] - y[1]) / hP - brusselator.dYdP1());
        }
        Assert.assertTrue((residualsP0.getMax() - residualsP0.getMin()) > 0.02);
        Assert.assertTrue((residualsP0.getMax() - residualsP0.getMin()) < 0.03);
        Assert.assertTrue(residualsP0.getStandardDeviation() > 0.003);
        Assert.assertTrue(residualsP0.getStandardDeviation() < 0.004);
View Full Code Here

    @Test
    public void testFloat() {
        MersenneTwister mt = new MersenneTwister(4442733263l);
        SummaryStatistics sample = new SummaryStatistics();
        for (int i = 0; i < 1000; ++i) {
            sample.addValue(mt.nextFloat());
        }
        assertEquals(0.5, sample.getMean(), 0.01);
        assertEquals(1.0 / (2.0 * Math.sqrt(3.0)),
                     sample.getStandardDeviation(),
                     0.006);
View Full Code Here

            Assert.assertEquals(5000, extInt.getMaxEvaluations());
            Assert.assertTrue(extInt.getEvaluations() > 2000);
            Assert.assertTrue(extInt.getEvaluations() < 2500);
            Assert.assertEquals(4 * integ.getEvaluations(), extInt.getEvaluations());
            residualsP0.addValue(dZdP[0][0] - brusselator.dYdP0());
            residualsP1.addValue(dZdP[1][0] - brusselator.dYdP1());
        }
        Assert.assertTrue((residualsP0.getMax() - residualsP0.getMin()) < 0.006);
        Assert.assertTrue(residualsP0.getStandardDeviation() < 0.0009);
        Assert.assertTrue((residualsP1.getMax() - residualsP1.getMin()) < 0.009);
        Assert.assertTrue(residualsP1.getStandardDeviation() < 0.0014);
View Full Code Here

            Assert.assertEquals(5000, extInt.getMaxEvaluations());
            Assert.assertTrue(extInt.getEvaluations() > 510);
            Assert.assertTrue(extInt.getEvaluations() < 610);
            Assert.assertEquals(integ.getEvaluations(), extInt.getEvaluations());
            residualsP0.addValue(dZdP[0][0] - brusselator.dYdP0());
            residualsP1.addValue(dZdP[1][0] - brusselator.dYdP1());
        }
        Assert.assertTrue((residualsP0.getMax() - residualsP0.getMin()) < 0.004);
        Assert.assertTrue(residualsP0.getStandardDeviation() < 0.0008);
        Assert.assertTrue((residualsP1.getMax() - residualsP1.getMin()) < 0.005);
        Assert.assertTrue(residualsP1.getStandardDeviation() < 0.0010);
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.