Example usage for org.apache.commons.math3.stat.inference TestUtils tTest

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

Introduction

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

Prototype

public static boolean tTest(final StatisticalSummary sampleStats1, final StatisticalSummary sampleStats2,
        final double alpha) throws NullArgumentException, NumberIsTooSmallException, OutOfRangeException,
        MaxCountExceededException 

Source Link

Usage

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.util.statistics.SingleSampleTTest.java

/**
 * {@inheritDoc}/*from  w  w w.  j  a  va 2  s. com*/
 * 
 * @see TestUtils#tTest(double, double[], double)
 */
@Override
public boolean test(double alpha) {
    return TestUtils.tTest(mean, categorize().get(0), alpha);
}

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.util.statistics.TwoSampleTTest.java

/**
 * {@inheritDoc}//  ww w . j ava  2 s  .  c  o m
 * 
 * @see TestUtils#tTest(double[], double[], double)
 * @see TestUtils#pairedTTest(double[], double[], double)
 */
@Override
public boolean test(double alpha) {
    List<double[]> categories = categorize();

    if (independent) {
        return TestUtils.tTest(categories.get(0), categories.get(1), alpha);
    } else {
        return TestUtils.pairedTTest(categories.get(0), categories.get(1), alpha);
    }
}

From source file:eu.crydee.alignment.aligner.ae.MetricsSummaryAE.java

@Override
public void collectionProcessComplete() throws AnalysisEngineProcessException {
    try {/*from  w  w  w  .j a va2  s .c o m*/
        String template = IOUtils.toString(getClass()
                .getResourceAsStream("/eu/crydee/alignment/aligner/ae/" + "metrics-summarizer-template.html"));
        String titledTemplate = template.replace("@@TITLE@@",
                "Metrics summarizer" + LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME));
        StringBuilder sb = new StringBuilder();
        sb.append("<table class=\"table table-striped ").append("table-condensed\">\n")
                .append("            <thead>\n").append("                <tr>\n")
                .append("                    <th>City\\Metric</th>\n");
        for (String key : keys) {
            sb.append("                    <th>").append(methodsMetadata.get(key).getRight()).append("</th>\n");
        }
        sb.append("                <tr>\n").append("            </thead>\n").append("            <tbody>\n");
        for (String ele : results.rowKeySet()) {
            sb.append("                <tr>\n").append("                    <td>").append(ele)
                    .append("</td>\n");
            Map<String, Samples> metricResults = results.row(ele);
            for (String key : keys) {
                Samples samples = metricResults.get(key);
                SummaryStatistics ss = new SummaryStatistics();
                samples.samples.forEach(d -> ss.addValue(d));
                double mean = ss.getMean();
                boolean significant = TestUtils.tTest(samples.mu,
                        ArrayUtils.toPrimitive(samples.samples.toArray(new Double[0])), 0.05),
                        above = samples.mu > mean;
                String summary = String.format("%.3f", samples.mu) + " <small class=\"text-muted\">"
                        + String.format("%.3f", ss.getMean()) + ""
                        + String.format("%.3f", ss.getStandardDeviation()) + "</small>";
                logger.info(ele + "\t" + key + "\t" + summary + "\t" + significant);
                sb.append("                    <td class=\"")
                        .append(significant ? (above ? "success" : "danger") : "warning").append("\">")
                        .append(summary).append("</td>\n");
            }
            sb.append("                </tr>\n");
        }
        sb.append("            </tbody>\n").append("        </table>");
        FileUtils.write(new File(htmlFilepath), titledTemplate.replace("@@TABLE@@", sb.toString()),
                StandardCharsets.UTF_8);
    } catch (IOException ex) {
        logger.error("IO problem with the HTML output.");
        throw new AnalysisEngineProcessException(ex);
    }
}

From source file:org.openjdk.jmh.util.AbstractStatistics.java

@Override
public boolean isDifferent(Statistics other, double confidence) {
    return TestUtils.tTest(this, other, 1 - confidence);
}