Package org.apache.commons.math.distribution

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


    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;
  }
 
  /**
   * @param args
View Full Code Here


   */
  public static void main(String[] args) throws Exception {
    if(true) {
      long time = System.currentTimeMillis();
      BinomialDistribution bd = new BinomialDistributionImpl(10000000, 0.5);
      double d = bd.cumulativeProbability(3456789);
      //for(int i=-1;i<=100000;i++) {
      //  double d = bd.cumulativeProbability(i);
      //  //System.out.println(i + "\t" + bd.cumulativeProbability(i) + "\t" + (1.0 - bd.cumulativeProbability(i)));
      //}
      System.out.println(System.currentTimeMillis() - time);
View Full Code Here

      throw new SSErrorXelException(SSError.NUM);
    else{
      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));
    }
  }
 
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.