@Test public void testTest() { logger.info("test"); int k = 10; int n = 40; double p = 0.35; boolean is_twoTailed = true; double aLevel = 0.05; boolean expResult = false; boolean result = Binomial.test(k, n, p, is_twoTailed, aLevel); assertEquals(expResult, result); }
public static boolean test(int k, int n, double p, boolean is_twoTailed, double aLevel) { if(k<0 || n<=0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } double pvalue = scoreToPvalue((double)k, n, p); boolean rejectH0=false; double a=aLevel; if(is_twoTailed) { a=aLevel/2.0; } if(pvalue<=a || pvalue>=(1.0-a)) { rejectH0=true; } return rejectH0; }
Binomial { public static boolean test(int k, int n, double p, boolean is_twoTailed, double aLevel) { if(k<0 || n<=0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } double pvalue = scoreToPvalue((double)k, n, p); boolean rejectH0=false; double a=aLevel; if(is_twoTailed) { a=aLevel/2.0; } if(pvalue<=a || pvalue>=(1.0-a)) { rejectH0=true; } return rejectH0; } }
Binomial { public static boolean test(int k, int n, double p, boolean is_twoTailed, double aLevel) { if(k<0 || n<=0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } double pvalue = scoreToPvalue((double)k, n, p); boolean rejectH0=false; double a=aLevel; if(is_twoTailed) { a=aLevel/2.0; } if(pvalue<=a || pvalue>=(1.0-a)) { rejectH0=true; } return rejectH0; }  }
Binomial { public static boolean test(int k, int n, double p, boolean is_twoTailed, double aLevel) { if(k<0 || n<=0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } double pvalue = scoreToPvalue((double)k, n, p); boolean rejectH0=false; double a=aLevel; if(is_twoTailed) { a=aLevel/2.0; } if(pvalue<=a || pvalue>=(1.0-a)) { rejectH0=true; } return rejectH0; }  static boolean test(int k, int n, double p, boolean is_twoTailed, double aLevel); }
Binomial { public static boolean test(int k, int n, double p, boolean is_twoTailed, double aLevel) { if(k<0 || n<=0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } double pvalue = scoreToPvalue((double)k, n, p); boolean rejectH0=false; double a=aLevel; if(is_twoTailed) { a=aLevel/2.0; } if(pvalue<=a || pvalue>=(1.0-a)) { rejectH0=true; } return rejectH0; }  static boolean test(int k, int n, double p, boolean is_twoTailed, double aLevel);  }