Examples of DistributionFactory


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

  public static Object statGammainv(Object[] args, XelContext ctx) throws MathException{
    //EXCEL: GAMMAINV(probability,alpha,beta)
    double p = CommonFns.toNumber(args[0]).doubleValue();
    double alpha = CommonFns.toNumber(args[1]).doubleValue();
    double beta = CommonFns.toNumber(args[2]).doubleValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    return UtilFns.validateNumber(factory.createGammaDistribution(alpha, beta).inverseCumulativeProbability(p));
  }
View Full Code Here

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

     */
    int s = CommonFns.toNumber(args[0]).intValue();
    int ns = CommonFns.toNumber(args[1]).intValue();
    int p = CommonFns.toNumber(args[2]).intValue();
    int np = CommonFns.toNumber(args[3]).intValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    //public HypergeometricDistributionImpl(int populationSize,int numberOfSuccesses,int sampleSize)
    return UtilFns.validateNumber(factory.createHypergeometricDistribution(np, p, ns).probability(s));
  }
View Full Code Here

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

     */
    double x = CommonFns.toNumber(args[0]).doubleValue();
    double mean = CommonFns.toNumber(args[1]).doubleValue();
    double sDev = CommonFns.toNumber(args[2]).doubleValue();
   
    DistributionFactory factory = DistributionFactory.newInstance();
    return UtilFns.validateNumber(factory.createNormalDistribution(mean,sDev).cumulativeProbability(x));
   
  }
View Full Code Here

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

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

  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

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

   * @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

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

   */
  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
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.