Package org.apache.commons.math.distribution

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

@version $Revision: 1054524 $ $Date: 2011-01-03 05:59:18 +0100 (lun. 03 janv. 2011) $ @since 2.0

    return LNorm.dlnorm(x, meanlog, sdlog, logP);
  }

  @DataParallel @Internal
  public static double dbeta(@Recycle double x, @Recycle double shape1, @Recycle double shape2, boolean log) {
    return d(new BetaDistributionImpl(shape1, shape2), x, log);
  }
View Full Code Here


    return Beta.dnbeta(x, shape1, shape2, ncp, log);
  }

  @DataParallel @Internal
  public static double pbeta(@Recycle double q, @Recycle double shape1, @Recycle double shape2, boolean lowerTail, boolean logP) {
    return p(new BetaDistributionImpl(shape1, shape2), q, lowerTail, logP);
  }
View Full Code Here

    return Beta.pnbeta(q, shape1, shape2, ncp, lowerTail, logP);
  }

  @DataParallel @Internal
  public static double qbeta(@Recycle double p, @Recycle double shape1, @Recycle double shape2, boolean lowerTail, boolean logP) {
    return q(new BetaDistributionImpl(shape1, shape2), p, lowerTail, logP);
  }
View Full Code Here

     * @return random value sampled from the beta(alpha, beta) distribution
     * @throws MathException if an error occurs generating the random value
     * @since 2.2
     */
    public double nextBeta(double alpha, double beta) throws MathException {
        return nextInversionDeviate(new BetaDistributionImpl(alpha, beta));
    }
View Full Code Here

        for (int i = 0; i < 10; i++) {
            quantiles[i] = randomData.nextUniform(0, 1);
        }
        // Reseed again so the inversion generator gets the same sequence
        randomData.reSeed(100);
        BetaDistributionImpl betaDistribution = new BetaDistributionImpl(2, 4);
        /*
         *  Generate a sequence of deviates using inversion - the distribution function
         *  evaluated at the random value from the distribution should match the uniform
         *  random value used to generate it, which is stored in the quantiles[] array.
         */
        for (int i = 0; i < 10; i++) {
            double value = randomData.nextInversionDeviate(betaDistribution);
            assertEquals(betaDistribution.cumulativeProbability(value), quantiles[i], 10E-9);
        }
    }
View Full Code Here

            assertEquals(betaDistribution.cumulativeProbability(value), quantiles[i], 10E-9);
        }
    }
   
    public void testNextBeta() throws Exception {
        double[] quartiles = TestUtils.getDistributionQuartiles(new BetaDistributionImpl(2,5));
        long[] counts = new long[4];
        randomData.reSeed(1000);
        for (int i = 0; i < 1000; i++) {
            double value = randomData.nextBeta(2, 5);
            TestUtils.updateCounts(value, counts, quartiles);
View Full Code Here

      return sum / total;
    }

    public double getBetaRandom() {
      try {
        return new BetaDistributionImpl(1 + sum, 1 + total - sum).sample();
      } catch (final MathException e) {
        e.printStackTrace();
        return -1;
      }
    }
View Full Code Here

    _a = a;
    _b = b;

    _x = x;

    BetaDistributionImpl betaDistribution = new BetaDistributionImpl(_a, _b);

    // FIXME : Fix this
    _recoveryRate = 0.0; //betaDistribution.inverseCumulativeProbability(_x);

    _recoveryRateType = RecoveryRateType.STOCHASTIC;
View Full Code Here

TOP

Related Classes of org.apache.commons.math.distribution.BetaDistributionImpl

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.