Examples of GammaDistribution

@version $Revision: 920852 $ $Date: 2010-03-09 13:53:44 +0100 (mar. 09 mars 2010) $
  • org.apache.commons.math3.distribution.GammaDistribution
    pedia.org/wiki/Gamma_distribution">Gamma distribution (Wikipedia) @see Gamma distribution (MathWorld)
  • org.jquantlib.math.distributions.GammaDistribution
    pedia.org/wiki/Gamma_distribution">Gamma Distribution @see Gamma Distribution on Wolfram MathWorld @author Richard Gomes @author Dominik Holenstein

  • Examples of com.opengamma.analytics.math.statistics.distribution.GammaDistribution

        final double m1 = _first.evaluate(x);
        final double m2 = _second.evaluate(x);
        final double m1Sq = m1 * m1;
        final double k = m1Sq / (m2 - m1Sq);
        final double theta = m1 / k;
        return new GammaDistribution(k, theta);
      }
    View Full Code Here

    Examples of com.opengamma.analytics.math.statistics.distribution.GammaDistribution

      @Test
      public void test() {
        final int n = 500000;
        final double k = 0.97;
        final double theta = 0.46;
        final ProbabilityDistribution<Double> p1 = new GammaDistribution(k, theta, new MersenneTwister(MersenneTwister.DEFAULT_SEED));
        final double[] x = new double[n];
        for (int i = 0; i < n; i++) {
          x[i] = p1.nextRandom();
        }
        final GammaDistribution p2 = (GammaDistribution) CALCULATOR.evaluate(x);
        final double eps = 0.025;
        assertEquals(p2.getK(), k, eps);
        assertEquals(p2.getTheta(), theta, eps);
      }
    View Full Code Here

    Examples of de.lmu.ifi.dbs.elki.data.synthetic.bymodel.distribution.GammaDistribution

          theta = Double.valueOf(thetastr);
        }

        // *** New normal distribution generator
        Random random = cluster.getNewRandomGenerator();
        Distribution generator = new GammaDistribution(k, theta, random);
        cluster.addGenerator(generator);

        // TODO: check for unknown attributes.
        for(Node child : new XMLNodeIterator(cur.getFirstChild())) {
          if(child.getNodeType() == Node.ELEMENT_NODE) {
    View Full Code Here

    Examples of de.lmu.ifi.dbs.elki.math.statistics.distribution.GammaDistribution

          theta = Double.parseDouble(thetastr);
        }

        // *** New normal distribution generator
        Random random = cluster.getNewRandomGenerator();
        Distribution generator = new GammaDistribution(k, theta, random);
        cluster.addGenerator(generator);

        // TODO: check for unknown attributes.
        for(Node child : new XMLNodeIterator(cur.getFirstChild())) {
          if(child.getNodeType() == Node.ELEMENT_NODE) {
    View Full Code Here

    Examples of org.apache.commons.math.distribution.GammaDistribution

        this.q = new QFunction(new NFunction(alpha1, beta1),
            new NFunction(alpha2, beta2), p);
      }
     
      public double eval(int n, double e) {
        GammaDistribution g1 = new GammaDistributionImpl(alpha1 + n, beta1 + e);
        GammaDistribution g2 = new GammaDistributionImpl(alpha2 + n, beta2 + e);
        PiFunction pi = new PiFunction(q.eval(n, e), g1, g2);
        PiFunctionIntegral ipi = new PiFunctionIntegral(pi, target);
       
       
       
    View Full Code Here

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

         * @return random value sampled from the Gamma(shape, scale) distribution
         * @throws NotStrictlyPositiveException if {@code shape <= 0} or
         * {@code scale <= 0}.
         */
        public double nextGamma(double shape, double scale) throws NotStrictlyPositiveException {
            return new GammaDistribution(getRandomGenerator(),shape, scale,
                    GammaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample();
        }
    View Full Code Here

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

        public void testNextGamma() {
            double[] quartiles;
            long[] counts;

            // Tests shape > 1, one case in the rejection sampling
            quartiles = TestUtils.getDistributionQuartiles(new GammaDistribution(4, 2));
            counts = new long[4];
            randomData.reSeed(1000);
            for (int i = 0; i < 1000; i++) {
                double value = randomData.nextGamma(4, 2);
                TestUtils.updateCounts(value, counts, quartiles);
            }
            TestUtils.assertChiSquareAccept(expected, counts, 0.001);

            // Tests shape <= 1, another case in the rejection sampling
            quartiles = TestUtils.getDistributionQuartiles(new GammaDistribution(0.3, 3));
            counts = new long[4];
            randomData.reSeed(1000);
            for (int i = 0; i < 1000; i++) {
                double value = randomData.nextGamma(0.3, 3);
                TestUtils.updateCounts(value, counts, quartiles);
    View Full Code Here

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

         * @return random value sampled from the Gamma(shape, scale) distribution
         * @throws NotStrictlyPositiveException if {@code shape <= 0} or
         * {@code scale <= 0}.
         */
        public double nextGamma(double shape, double scale) throws NotStrictlyPositiveException {
            return new GammaDistribution(getRandomGenerator(),shape, scale,
                    GammaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample();
        }
    View Full Code Here

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

        public void testNextGamma() {
            double[] quartiles;
            long[] counts;

            // Tests shape > 1, one case in the rejection sampling
            quartiles = TestUtils.getDistributionQuartiles(new GammaDistribution(4, 2));
            counts = new long[4];
            randomData.reSeed(1000);
            for (int i = 0; i < 1000; i++) {
                double value = randomData.nextGamma(4, 2);
                TestUtils.updateCounts(value, counts, quartiles);
            }
            TestUtils.assertChiSquareAccept(expected, counts, 0.001);

            // Tests shape <= 1, another case in the rejection sampling
            quartiles = TestUtils.getDistributionQuartiles(new GammaDistribution(0.3, 3));
            counts = new long[4];
            randomData.reSeed(1000);
            for (int i = 0; i < 1000; i++) {
                double value = randomData.nextGamma(0.3, 3);
                TestUtils.updateCounts(value, counts, quartiles);
    View Full Code Here

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

                container.add(comp, c);

                c.gridx++;
                comp = createComponent("Gamma", 0, 20,
                                       new String[] { "k=1,θ=2", "k=2,θ=2", "k=3,θ=2", "k=5,θ=1", "k=9,θ=0.5" },
                                       new GammaDistribution(1, 2),
                                       new GammaDistribution(2, 2),
                                       new GammaDistribution(3, 2),
                                       new GammaDistribution(5, 1),
                                       new GammaDistribution(9, 0.5));
                container.add(comp, c);

                c.gridx++;
                RandomGenerator rng = new MersenneTwister(0);
                comp = createComponent("Levy", 0, 3,
    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.