@Test public void testBetaCdf() { logger.info("BetaCdf"); double x = 0.9; double a = 10.0; double b = 2.0; double expResult = 0.69735688048532; double result = ContinuousDistributions.betaCdf(x, a, b); assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); }
public static double betaCdf(double x, double a, double b) { if(x<0 || a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double Bcdf = 0.0; if(x==0) { return Bcdf; } else if (x>=1) { Bcdf=1.0; return Bcdf; } double S= a + b; double BT = Math.exp(logGamma(S)-logGamma(b)-logGamma(a)+a*Math.log(x)+b*Math.log(1-x)); if (x<(a+1.0)/(S+2.0)) { Bcdf=BT*betinc(x,a,b); } else { Bcdf=1.0-BT*betinc(1.0-x,b,a); } return Bcdf; }
ContinuousDistributions { public static double betaCdf(double x, double a, double b) { if(x<0 || a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double Bcdf = 0.0; if(x==0) { return Bcdf; } else if (x>=1) { Bcdf=1.0; return Bcdf; } double S= a + b; double BT = Math.exp(logGamma(S)-logGamma(b)-logGamma(a)+a*Math.log(x)+b*Math.log(1-x)); if (x<(a+1.0)/(S+2.0)) { Bcdf=BT*betinc(x,a,b); } else { Bcdf=1.0-BT*betinc(1.0-x,b,a); } return Bcdf; } }
ContinuousDistributions { public static double betaCdf(double x, double a, double b) { if(x<0 || a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double Bcdf = 0.0; if(x==0) { return Bcdf; } else if (x>=1) { Bcdf=1.0; return Bcdf; } double S= a + b; double BT = Math.exp(logGamma(S)-logGamma(b)-logGamma(a)+a*Math.log(x)+b*Math.log(1-x)); if (x<(a+1.0)/(S+2.0)) { Bcdf=BT*betinc(x,a,b); } else { Bcdf=1.0-BT*betinc(1.0-x,b,a); } return Bcdf; }  }
ContinuousDistributions { public static double betaCdf(double x, double a, double b) { if(x<0 || a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double Bcdf = 0.0; if(x==0) { return Bcdf; } else if (x>=1) { Bcdf=1.0; return Bcdf; } double S= a + b; double BT = Math.exp(logGamma(S)-logGamma(b)-logGamma(a)+a*Math.log(x)+b*Math.log(1-x)); if (x<(a+1.0)/(S+2.0)) { Bcdf=BT*betinc(x,a,b); } else { Bcdf=1.0-BT*betinc(1.0-x,b,a); } return Bcdf; }  static double chisquareCdf(double x, int df); static double gaussCdf(double z); static double gamma(double x); static double logGamma(double Z); static double studentsCdf(double x, int df); static double exponentialCdf(double x, double lamda); static double betaCdf(double x, double a, double b); static double fCdf(double x, int f1, int f2); static double gammaCdf(double x, double a, double b); static double uniformCdf(double x, double a, double b); static double kolmogorov(double z); static double gaussInverseCdf(double p); static double chisquareInverseCdf(double p, int df); static double normalQuantile(double p, double mu, double sigma); static double dirichletPdf(double[] pi, double[] ai); static double dirichletPdf(double[] pi, double a); static double[] multinomialGaussianSample(double[] mean, double[][] covariance); static double multinomialGaussianPdf(double[] mean, double[][] covariance, double[] x); }
ContinuousDistributions { public static double betaCdf(double x, double a, double b) { if(x<0 || a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double Bcdf = 0.0; if(x==0) { return Bcdf; } else if (x>=1) { Bcdf=1.0; return Bcdf; } double S= a + b; double BT = Math.exp(logGamma(S)-logGamma(b)-logGamma(a)+a*Math.log(x)+b*Math.log(1-x)); if (x<(a+1.0)/(S+2.0)) { Bcdf=BT*betinc(x,a,b); } else { Bcdf=1.0-BT*betinc(1.0-x,b,a); } return Bcdf; }  static double chisquareCdf(double x, int df); static double gaussCdf(double z); static double gamma(double x); static double logGamma(double Z); static double studentsCdf(double x, int df); static double exponentialCdf(double x, double lamda); static double betaCdf(double x, double a, double b); static double fCdf(double x, int f1, int f2); static double gammaCdf(double x, double a, double b); static double uniformCdf(double x, double a, double b); static double kolmogorov(double z); static double gaussInverseCdf(double p); static double chisquareInverseCdf(double p, int df); static double normalQuantile(double p, double mu, double sigma); static double dirichletPdf(double[] pi, double[] ai); static double dirichletPdf(double[] pi, double a); static double[] multinomialGaussianSample(double[] mean, double[][] covariance); static double multinomialGaussianPdf(double[] mean, double[][] covariance, double[] x);  }