Package org.apache.commons.math.distribution

Examples of org.apache.commons.math.distribution.BinomialDistribution.probability()


  public static double binomialProbEqualGreater(int trials, int success, double prob) throws MathException {
    BinomialDistribution bd = new BinomialDistributionImpl(trials, prob);
    double score = 0;
    for(int i=success;i<=trials;i++) {
      score += bd.probability(i);
    }
    //double score = bd.cumulativeProbability(success-1);
    System.out.println("bd:\t" + trials + "\t" + success + "\t" + prob + "\t" + (1.0-score) + "\t" + bd.cumulativeProbability(success-1));
    return 1.0 - score;
  }
View Full Code Here


      DistributionFactory factory = DistributionFactory.newInstance();
      BinomialDistribution bd = factory.createBinomialDistribution(trails, p_s);
      if(isCumulative)
        return UtilFns.validateNumber(bd.cumulativeProbability(number));
      else
        return UtilFns.validateNumber(bd.probability(number));
    }
  }
 
  /**
   * Returns the one-tailed probability of the chi-squared distribution
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.