Package org.apache.commons.math.distribution

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


    boolean isCumulative = ((Boolean)args[3]).booleanValue();
   
    if(number>trails || number <0)
      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


    double x = CommonFns.toNumber(args[0]).doubleValue();
    double df = CommonFns.toNumber(args[1]).doubleValue();
    if(x <0)
      throw new SSErrorXelException(SSError.NUM);
    else{   
      DistributionFactory factory = DistributionFactory.newInstance();
      return UtilFns.validateNumber(1-factory.createChiSquareDistribution(df).cumulativeProbability(x));
    }
  }
View Full Code Here

    double p = CommonFns.toNumber(args[0]).doubleValue();
    double df = CommonFns.toNumber(args[1]).doubleValue();
    if(p<0 || p>1)
      throw new SSErrorXelException(SSError.NUM);
    else{
      DistributionFactory factory = DistributionFactory.newInstance();
      return UtilFns.validateNumber(factory.createChiSquareDistribution(df).inverseCumulativeProbability((1-p)));
    }
  }
View Full Code Here

    double x = CommonFns.toNumber(args[0]).doubleValue();
    double lambda = CommonFns.toNumber(args[1]).doubleValue();
    double mean = 1 / lambda;
    boolean isCumulative = ((Boolean)args[2]).booleanValue();
   
    DistributionFactory factory = DistributionFactory.newInstance();
    if(isCumulative)
      return UtilFns.validateNumber(factory.createExponentialDistribution(mean).cumulativeProbability(x));
    else
      return UtilFns.validateNumber((1-factory.createExponentialDistribution(mean).cumulativeProbability(x))/mean);
  }
View Full Code Here

      Degrees_freedom2   is the denominator degrees of freedom.
     */
    double x = CommonFns.toNumber(args[0]).doubleValue();
    double df = CommonFns.toNumber(args[1]).doubleValue();
    double ddf = CommonFns.toNumber(args[2]).doubleValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    return UtilFns.validateNumber(factory.createFDistribution(df, ddf).cumulativeProbability(x));
  }
View Full Code Here

   */
  public static Object statFinv(Object[] args, XelContext ctx) throws MathException{
    double p = CommonFns.toNumber(args[0]).doubleValue();
    double df = CommonFns.toNumber(args[1]).doubleValue();
    double ddf = CommonFns.toNumber(args[2]).doubleValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    return UtilFns.validateNumber(factory.createFDistribution(df, ddf).inverseCumulativeProbability(p));
  }
View Full Code Here

    //EXCEL: GAMMADIST(x,alpha,beta,cumulative)
    double x = CommonFns.toNumber(args[0]).doubleValue();
    double alpha = CommonFns.toNumber(args[1]).doubleValue();
    double beta = CommonFns.toNumber(args[2]).doubleValue();
    boolean isCumulative = ((Boolean)args[3]).booleanValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    if(isCumulative)
      return UtilFns.validateNumber(factory.createGammaDistribution(alpha, beta).cumulativeProbability(x));
    else
      return new Integer(-1); //TODO
  }
View Full Code Here

  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

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

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

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.