Package org.apache.commons.math.distribution

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


    return d(new BinomialDistributionImpl(size, prob), x, log);
  }

  @DataParallel @Internal
  public static double dnbinom(@Recycle double x, @Recycle int size, @Recycle double prob, boolean log) {
    return d(new PascalDistributionImpl(size, prob), x, log);
  }
View Full Code Here


    return p(new BinomialDistributionImpl(size, prob), x, lowerTail, logP);
  }

  @DataParallel @Internal
  public static double pnbinom(@Recycle double x, @Recycle int size, @Recycle double prob, boolean lowerTail, boolean logP) {
    return p(new PascalDistributionImpl(size, prob), x, lowerTail, logP);
  }
View Full Code Here

     * @return random value sampled from the Pascal(r, p) distribution
     * @throws MathException if an error occurs generating the random value
     * @since 2.2
     */
    public int nextPascal(int r, double p) throws MathException {
        return nextInversionDeviate(new PascalDistributionImpl(r, p));
    }
View Full Code Here

        PascalDistributionTest testInstance = new PascalDistributionTest("");
        int[] densityPoints = testInstance.makeDensityTestPoints();
        double[] densityValues = testInstance.makeDensityTestValues();
        int sampleSize = 1000;
        int length = TestUtils.eliminateZeroMassPoints(densityPoints, densityValues);
        PascalDistributionImpl distribution = (PascalDistributionImpl) testInstance.makeDistribution();
        double[] expectedCounts = new double[length];
        long[] observedCounts = new long[length];
        for (int i = 0; i < length; i++) {
            expectedCounts[i] = sampleSize * densityValues[i];
        }
        randomData.reSeed(1000);
        for (int i = 0; i < sampleSize; i++) {
          int value = randomData.nextPascal(distribution.getNumberOfSuccesses(), distribution.getProbabilityOfSuccess());
          for (int j = 0; j < length; j++) {
              if (value == densityPoints[j]) {
                  observedCounts[j]++;
              }
          }
View Full Code Here

TOP

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

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.