Package org.apache.commons.math.distribution

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


   */
  public static Object statPoisson(Object[] args, XelContext ctx) throws MathException{
    double x = CommonFns.toNumber(args[0]).doubleValue();
    double mean = CommonFns.toNumber(args[1]).doubleValue();
    boolean isCumulative = ((Boolean)args[2]).booleanValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    PoissonDistribution pd = factory.createPoissonDistribution(mean);
    if(isCumulative)
      return UtilFns.validateNumber(pd.cumulativeProbability(x));
    else
      return UtilFns.validateNumber(pd.probability(x));
  }
View Full Code Here


  public static Object statTdist(Object[] args, XelContext ctx) throws MathException{
    //EXCEL: TDIST(x,degrees_freedom,tails)
    double x = CommonFns.toNumber(args[0]).doubleValue();
    double degree_freedom = CommonFns.toNumber(args[1]).doubleValue();
    int tails = CommonFns.toNumber(args[2]).intValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    TDistribution td = factory.createTDistribution(degree_freedom );
    return UtilFns.validateNumber(1 - td.cumulativeProbability(x));
  }
View Full Code Here

   * @throws MathException
   */
  public static Object statTinv(Object[] args, XelContext ctx) throws MathException{
    double p = CommonFns.toNumber(args[0]).doubleValue();
    double degree_freedom = CommonFns.toNumber(args[1]).doubleValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    TDistribution td = factory.createTDistribution(degree_freedom );
    return UtilFns.validateNumber(td.inverseCumulativeProbability((1-p)));
  }
View Full Code Here

   */
  public static Object statWeibull(Object[] args, XelContext ctx) throws MathException{
    double x = CommonFns.toNumber(args[0]).doubleValue();
    double alpha = CommonFns.toNumber(args[1]).doubleValue();
    double beta = CommonFns.toNumber(args[1]).doubleValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    WeibullDistribution wb = factory.createWeibullDistribution(alpha, beta);
    return UtilFns.validateNumber(wb.cumulativeProbability(x));
  }
View Full Code Here

TOP

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

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.