Stat { public static double logBinom(int n, int i) { return logNfactExact(n) - (logNfactExact(i) + logNfactExact(n - i)); }  static double hg(long D, long gt, long S); static double hgapprox(long D, long gt, int S); static double beta_CDF(double x, int a, int b); static double incompleteBeta(double x, int a, int b); static double beta(int a, int b); static double ix(double x, int a, int b); static double logNfact(long n); static long nFactExact(long n); static double binom(int n, int i); static double logBinom(int n, int i); static double logoggs(double p); static double logit(double logodds); static void main(String[] args);  }
@Test public final void testLogBinom() { RangePairIntInt rp = new RangePairIntInt(); rp.setRange1(5, 10); rp.setRange2(1, 4); double ress[] = { 1.609, 1.792, 1.946, 2.079, 2.197, 2.303, 2.303, 2.708, 3.045, 3.332, 3.584, 3.807, 2.303, 2.996, 3.555, 4.025, 4.431, 4.787, 1.609, 2.708, 3.555, 4.248, 4.836, 5.347 }; List<ModelIntIntDouble> testData = TestDataManager.fillTestCasesIntIntDouble(rp,ress); for(ModelIntIntDouble datum : testData) { assertEquals(datum.getRes(), Stat.logBinom(datum.getArg1(), datum.getArg2()),TestDataManager.DELTA_DOUBLE); } }