@Test public void testTestOddsRatio() { logger.info("testOddsRatio"); int n11 = 131; int n12 = 33; int n21 = 251; int n22 = 4; boolean is_twoTailed = false; double aLevel = 0.05; boolean expResult = true; boolean result = NormalIndependentSamples.testOddsRatio(n11, n12, n21, n22, is_twoTailed, aLevel); assertEquals(expResult, result); }
public static boolean testOddsRatio(int n11, int n12, int n21, int n22, boolean is_twoTailed, double aLevel) { if(n11<=0 || n12<=0 || n21<=0 || n22<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double thita=((double)n11*n22)/(n12*n21); double z=Math.log(thita)/Math.sqrt(1.0/n11+1.0/n12+1.0/n21+1.0/n22); boolean rejectH0=checkCriticalValue(z, is_twoTailed, aLevel); return rejectH0; }
NormalIndependentSamples { public static boolean testOddsRatio(int n11, int n12, int n21, int n22, boolean is_twoTailed, double aLevel) { if(n11<=0 || n12<=0 || n21<=0 || n22<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double thita=((double)n11*n22)/(n12*n21); double z=Math.log(thita)/Math.sqrt(1.0/n11+1.0/n12+1.0/n21+1.0/n22); boolean rejectH0=checkCriticalValue(z, is_twoTailed, aLevel); return rejectH0; } }
NormalIndependentSamples { public static boolean testOddsRatio(int n11, int n12, int n21, int n22, boolean is_twoTailed, double aLevel) { if(n11<=0 || n12<=0 || n21<=0 || n22<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double thita=((double)n11*n22)/(n12*n21); double z=Math.log(thita)/Math.sqrt(1.0/n11+1.0/n12+1.0/n21+1.0/n22); boolean rejectH0=checkCriticalValue(z, is_twoTailed, aLevel); return rejectH0; }  }
NormalIndependentSamples { public static boolean testOddsRatio(int n11, int n12, int n21, int n22, boolean is_twoTailed, double aLevel) { if(n11<=0 || n12<=0 || n21<=0 || n22<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double thita=((double)n11*n22)/(n12*n21); double z=Math.log(thita)/Math.sqrt(1.0/n11+1.0/n12+1.0/n21+1.0/n22); boolean rejectH0=checkCriticalValue(z, is_twoTailed, aLevel); return rejectH0; }  static boolean testMeans(double xbar, double ybar, int n, int m, double stdx, double stdy, boolean is_twoTailed, double aLevel); static boolean testPercentages(double p1bar, double p2bar, int n1, int n2, boolean is_twoTailed, double aLevel); static boolean testOddsRatio(int n11, int n12, int n21, int n22, boolean is_twoTailed, double aLevel); }
NormalIndependentSamples { public static boolean testOddsRatio(int n11, int n12, int n21, int n22, boolean is_twoTailed, double aLevel) { if(n11<=0 || n12<=0 || n21<=0 || n22<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double thita=((double)n11*n22)/(n12*n21); double z=Math.log(thita)/Math.sqrt(1.0/n11+1.0/n12+1.0/n21+1.0/n22); boolean rejectH0=checkCriticalValue(z, is_twoTailed, aLevel); return rejectH0; }  static boolean testMeans(double xbar, double ybar, int n, int m, double stdx, double stdy, boolean is_twoTailed, double aLevel); static boolean testPercentages(double p1bar, double p2bar, int n1, int n2, boolean is_twoTailed, double aLevel); static boolean testOddsRatio(int n11, int n12, int n21, int n22, boolean is_twoTailed, double aLevel);  }