Example usage for org.apache.commons.math3.stat.inference GTest GTest

List of usage examples for org.apache.commons.math3.stat.inference GTest GTest

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.inference GTest GTest.

Prototype

GTest

Source Link

Usage

From source file:org.apache.solr.client.solrj.io.eval.GTestDataSetEvaluator.java

@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();
    }//from  w w  w.  j  av  a2  s .  c  o  m

    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);
}