Package org.apache.commons.math3.distribution

Examples of org.apache.commons.math3.distribution.NormalDistribution


    for (int i = 0; i < data.length; i++) {
      data[i] = sampler.sample();
    }
    Arrays.sort(data);

    NormalDistribution reference = new NormalDistribution(RandomUtils.getRandom().getRandomGenerator(),
                                                          0, 1,
                                                          NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
    assertEquals("Median", reference.inverseCumulativeProbability(0.5), data[5000], 0.04);
  }
View Full Code Here


    final double cdf(long timestamp, Double[] samples) {
      double cdf = -1d;
      final double mean = mean(samples);
      final double variance = variance(samples);
      // N.B.: NormalDistribution commons math v2.0 will cause init Node hanged.
      final NormalDistribution cal = new NormalDistribution(mean, variance);
      final double rt = (double) timestamp - (double) getLatestHeartbeat();
      cdf = cal.cumulativeProbability(rt);
      if (LOG.isDebugEnabled())
        LOG.debug("Calcuated cdf:" + cdf + " END");
      return cdf;
    }
View Full Code Here

        }else{
            presentLife = getPresent();
        }
        //System.out.println(expectedValue);
        //System.out.println(standardDeviation);
        NormalDistribution normDist = new NormalDistribution(expectedValue, standardDeviation);
        normalHazardRate = (normDist.density(presentLife)/(1-normDist.cumulativeProbability(presentLife)))/timeDiv;
        //System.out.println(1-normDist.cumulativeProbability(presentLife));
        //System.out.println(presentLife);
        if(breakPoint>0f){
            //Use the reduction Factor or Not
            if("Y".equals(repMod)){
View Full Code Here

    final double cdf(long timestamp, Double[] samples) {
      double cdf = -1d;
      final double mean = mean(samples);
      final double variance = variance(samples);
      // N.B.: NormalDistribution commons math v2.0 will cause init Node hanged.
      final NormalDistribution cal = new NormalDistribution(mean, variance);
      final double rt = (double) timestamp - (double) getLatestHeartbeat();
      cdf = cal.cumulativeProbability(rt);
      if (LOG.isDebugEnabled())
        LOG.debug("Calcuated cdf:" + cdf + " END");
      return cdf;
    }
View Full Code Here

        }

        @Override
        public Distribution get()
        {
            return new DistributionBoundApache(new NormalDistribution(new JDKRandomGenerator(), mean, stdev, NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY), min, max);
        }
View Full Code Here

        }

        @Override
        public Distribution get()
        {
            return new DistributionBoundApache(new NormalDistribution(new JDKRandomGenerator(), mean, stdev, NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY), min, max);
        }
View Full Code Here

        final double VarU = n1n2prod * (n1 + n2 + 1) / 12.0;

        final double z = (Umin - EU) / FastMath.sqrt(VarU);

        // No try-catch or advertised exception because args are valid
        final NormalDistribution standardNormal = new NormalDistribution(0, 1);

        return 2 * standardNormal.cumulativeProbability(z);
    }
View Full Code Here

     * @param bStats summary statistics for the bin
     * @return within-bin kernel parameterized by bStats
     */
    private RealDistribution getKernel(SummaryStatistics bStats) {
        // For now, hard-code Gaussian (only kernel supported)
        return new NormalDistribution(
                bStats.getMean(), bStats.getStandardDeviation());
    }
View Full Code Here

        // - 0.5 is a continuity correction
        final double z = (Wmin - ES - 0.5) / FastMath.sqrt(VarS);

        // No try-catch or advertised exception because args are valid
        final NormalDistribution standardNormal = new NormalDistribution(0, 1);

        return 2*standardNormal.cumulativeProbability(z);
    }
View Full Code Here

    @Test
    public void testRandomDataNormalDistribution() {
        for (int run = 0; run < 100; run++) {
            Random r = new Random(System.currentTimeMillis());
            NormalDistribution dist = new NormalDistribution(0.0, r.nextDouble() * 5);

            // matrix size
            int size = r.nextInt(20) + 4;

            double[][] data = new double[size][size];
            for (int i = 0; i < size; i++) {
                for (int j = 0; j < size; j++) {
                    data[i][j] = dist.sample();
                }
            }

            RealMatrix m = MatrixUtils.createRealMatrix(data);
            RealMatrix h = checkAEqualPHPt(m);
View Full Code Here

TOP

Related Classes of org.apache.commons.math3.distribution.NormalDistribution

Copyright © 2018 www.massapicom. 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.