@Test public void testStudentsCdf() { logger.info("StudentsCdf"); double x = 3.0; int df = 10; double expResult = 0.99332817273466; double result = ContinuousDistributions.studentsCdf(x, df); assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); }
public static double studentsCdf(double x, int df) { if(df<=0) { throw new IllegalArgumentException("The degrees of freedom need to be positive."); } double A = df/2.0; double S = A+0.5; double Z = df/(df + x*x); double BT = Math.exp(logGamma(S)-logGamma(0.5)-logGamma(A)+A*Math.log(Z)+0.5*Math.log(1.0-Z)); double betacdf; if (Z<(A+1.0)/(S+2.0)) { betacdf = BT*betinc(Z,A,0.5); } else { betacdf=1-BT*betinc(1.0-Z,0.5,A); } double tcdf; if (x<0) { tcdf=betacdf/2.0; } else { tcdf=1.0-betacdf/2.0; } return tcdf; }
ContinuousDistributions { public static double studentsCdf(double x, int df) { if(df<=0) { throw new IllegalArgumentException("The degrees of freedom need to be positive."); } double A = df/2.0; double S = A+0.5; double Z = df/(df + x*x); double BT = Math.exp(logGamma(S)-logGamma(0.5)-logGamma(A)+A*Math.log(Z)+0.5*Math.log(1.0-Z)); double betacdf; if (Z<(A+1.0)/(S+2.0)) { betacdf = BT*betinc(Z,A,0.5); } else { betacdf=1-BT*betinc(1.0-Z,0.5,A); } double tcdf; if (x<0) { tcdf=betacdf/2.0; } else { tcdf=1.0-betacdf/2.0; } return tcdf; } }
ContinuousDistributions { public static double studentsCdf(double x, int df) { if(df<=0) { throw new IllegalArgumentException("The degrees of freedom need to be positive."); } double A = df/2.0; double S = A+0.5; double Z = df/(df + x*x); double BT = Math.exp(logGamma(S)-logGamma(0.5)-logGamma(A)+A*Math.log(Z)+0.5*Math.log(1.0-Z)); double betacdf; if (Z<(A+1.0)/(S+2.0)) { betacdf = BT*betinc(Z,A,0.5); } else { betacdf=1-BT*betinc(1.0-Z,0.5,A); } double tcdf; if (x<0) { tcdf=betacdf/2.0; } else { tcdf=1.0-betacdf/2.0; } return tcdf; }  }
ContinuousDistributions { public static double studentsCdf(double x, int df) { if(df<=0) { throw new IllegalArgumentException("The degrees of freedom need to be positive."); } double A = df/2.0; double S = A+0.5; double Z = df/(df + x*x); double BT = Math.exp(logGamma(S)-logGamma(0.5)-logGamma(A)+A*Math.log(Z)+0.5*Math.log(1.0-Z)); double betacdf; if (Z<(A+1.0)/(S+2.0)) { betacdf = BT*betinc(Z,A,0.5); } else { betacdf=1-BT*betinc(1.0-Z,0.5,A); } double tcdf; if (x<0) { tcdf=betacdf/2.0; } else { tcdf=1.0-betacdf/2.0; } return tcdf; }  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 studentsCdf(double x, int df) { if(df<=0) { throw new IllegalArgumentException("The degrees of freedom need to be positive."); } double A = df/2.0; double S = A+0.5; double Z = df/(df + x*x); double BT = Math.exp(logGamma(S)-logGamma(0.5)-logGamma(A)+A*Math.log(Z)+0.5*Math.log(1.0-Z)); double betacdf; if (Z<(A+1.0)/(S+2.0)) { betacdf = BT*betinc(Z,A,0.5); } else { betacdf=1-BT*betinc(1.0-Z,0.5,A); } double tcdf; if (x<0) { tcdf=betacdf/2.0; } else { tcdf=1.0-betacdf/2.0; } return tcdf; }  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);  }