Examples of IncorrectDistributionParameterException


Examples of jmt.common.exception.IncorrectDistributionParameterException

      //double lambda = p.getLambda();
      //double alpha = p.getAlpha();
      double lambda = ((GammaDistrPar) p).getLambda();
      double alpha = ((GammaDistrPar) p).getAlpha();
      if (x < 0) {
        throw new IncorrectDistributionParameterException("x must be >= 0.0");
      }
      if (x == 0) {
        if (alpha == 1.0) {
          return 1.0 / lambda;
        } else {
          return 0.0;
        }
      }
      if (alpha == 1.0) {
        return Math.exp(-x / lambda) / lambda;
      }

      return Math.exp((alpha - 1.0) * Math.log(x / lambda) - x / lambda - Sfun.logGamma(alpha)) / lambda;
    } else {
      throw new IncorrectDistributionParameterException("Remember: parameter alpha and lambda must be gtz");
    }
  }
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.