Package org.apache.commons.math3.distribution

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


        }

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


     * The first bin includes its lower bound, 0, so has different mean and
     * standard deviation.
     */
    private RealDistribution findKernel(double lower, double upper) {
        if (lower < 1) {
            return new NormalDistribution(5d, 3.3166247903554);
        } else {
            return new NormalDistribution((upper + lower + 1) / 2d, 3.0276503540974917);
        }
    }
View Full Code Here

            randomData.nextGaussian(0, 0);
            Assert.fail("zero sigma -- MathIllegalArgumentException expected");
        } catch (MathIllegalArgumentException ex) {
            // ignored
        }
        double[] quartiles = TestUtils.getDistributionQuartiles(new NormalDistribution(0,1));
        long[] counts = new long[4];
        randomData.reSeed(1000);
        for (int i = 0; i < 1000; i++) {
            double value = randomData.nextGaussian(0, 1);
            TestUtils.updateCounts(value, counts, quartiles);
View Full Code Here

     * @param bStats summary statistics for the bin
     * @return within-bin kernel parameterized by bStats
     */
    protected RealDistribution getKernel(SummaryStatistics bStats) {
        // Default to Gaussian
        return new NormalDistribution(randomData.getRandomGenerator(),
                bStats.getMean(), bStats.getStandardDeviation(),
                NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
    }
View Full Code Here

        double pval = 0;
        double N = di.getAvgDepthWindow();
        double p = 0.5;

        if (N > 30) {
            NormalDistribution n = new NormalDistribution(N * p, Math.sqrt(N * p * (1 - p)));
        } else {
            BinomialDistribution bn = new BinomialDistribution((int) N, p);
            double observed = di.getDeletionDepth();
        }

View Full Code Here

        }
    }

    public void test() {
        BinomialDistribution bn = new BinomialDistribution(120, 0.5);
        NormalDistribution n = new NormalDistribution(60, Math.sqrt(30));

        PVector param_norm = new PVector(2);
        param_norm.array[0] = 60;   // mean
        param_norm.array[1] = 30;   // var

        PVector param_bino = new PVector(2);
        param_bino.array[0] = 120;   // n
        param_bino.array[1] = 0.5;   // p

        ExponentialFamily normal = new UnivariateGaussian();
        PVector p = new PVector(1);
        p.array[0] = 32;

        System.out.println(bn.cumulativeProbability(32));
        System.out.println(n.cumulativeProbability(32));
        System.out.println(normal.density(p, param_norm));

        p.array[0] = 27;
        System.out.println(bn.cumulativeProbability(27));
        System.out.println(n.cumulativeProbability(27));
        System.out.println(n.density(27));
        System.out.println(normal.density(p, param_norm));

        p.array[0] = 60;
        System.out.println(bn.cumulativeProbability(60));
        System.out.println(n.cumulativeProbability(60));
        System.out.println(n.density(60));
        System.out.println(normal.density(p, param_norm));



    }
View Full Code Here

    public static DataGenHex buildGaussian(long minKey, long maxKey, double stdevsToLimit)
    {
        double midRange = (maxKey + minKey) / 2d;
        double halfRange = (maxKey - minKey) / 2d;
        return new DataGenHexFromDistribution(new DistributionBoundApache(new NormalDistribution(midRange, halfRange / stdevsToLimit), minKey, maxKey));
    }
View Full Code Here

        return new DataGenHexFromDistribution(new DistributionBoundApache(new NormalDistribution(midRange, halfRange / stdevsToLimit), minKey, maxKey));
    }

    public static DataGenHex buildGaussian(long minKey, long maxKey, double mean, double stdev)
    {
        return new DataGenHexFromDistribution(new DistributionBoundApache(new NormalDistribution(mean, stdev), minKey, maxKey));
    }
View Full Code Here

        }

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

   * @param sd
   *          a double standard deviation
   * @return a double sample
   */
  public static double rNorm(double mean, double sd) {
    RealDistribution dist = new NormalDistribution(RANDOM.getRandomGenerator(),
                                                   mean,
                                                   sd,
                                                   NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
    return dist.sample();
  }
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.