/** * @see org.apache.commons.math3.stat.inference.GTest#gDataSetsComparison(long[], long[]) * @since 3.1 */ public static double gDataSetsComparison(final long[] observed1, final long[] observed2) throws DimensionMismatchException, NotPositiveException, ZeroException { return G_TEST.gDataSetsComparison(observed1, observed2); }
final double llr = gDataSetsComparison( new long[]{k11, k12}, new long[]{k21, k22}); double sqrt = FastMath.sqrt(llr);
new ChiSquaredDistribution(null, (double) observed1.length - 1); return 1 - distribution.cumulativeProbability( gDataSetsComparison(observed1, observed2));
/** * @see org.apache.commons.math3.stat.inference.GTest#gDataSetsComparison(long[], long[]) * @since 3.1 */ public static double gDataSetsComparison(final long[] observed1, final long[] observed2) throws DimensionMismatchException, NotPositiveException, ZeroException { return G_TEST.gDataSetsComparison(observed1, observed2); }
final double llr = gDataSetsComparison( new long[]{k11, k12}, new long[]{k21, k22}); double sqrt = Math.sqrt(llr);
@Override public Object doWork(Object value1, Object value2) throws IOException { List<Number> listA = (List<Number>) value1; List<Number> listB = (List<Number>) value2; long[] sampleA = new long[listA.size()]; long[] sampleB = new long[listB.size()]; for(int i=0; i<sampleA.length; i++) { sampleA[i] = listA.get(i).longValue(); } for(int i=0; i<sampleB.length; i++) { sampleB[i] = listB.get(i).longValue(); } GTest gTest = new GTest(); double g = gTest.gDataSetsComparison(sampleA, sampleB); double p = gTest.gTestDataSetsComparison(sampleA, sampleB); Map<String,Number> m = new HashMap<>(); m.put("G-statistic", g); m.put("p-value", p); return new Tuple(m); } }
final double llr = gDataSetsComparison( new long[]{k11, k12}, new long[]{k21, k22}); double sqrt = FastMath.sqrt(llr);
new ChiSquaredDistribution(null, (double) observed1.length - 1); return 1 - distribution.cumulativeProbability( gDataSetsComparison(observed1, observed2));
new ChiSquaredDistribution(null, (double) observed1.length - 1); return 1 - distribution.cumulativeProbability( gDataSetsComparison(observed1, observed2));