Apache Commons logo Apache Commons Statistics

Apache Commons Statistics: Inference

Apache Commons Statistics provides statistical hypothesis testing.

Example:

import org.apache.commons.statistics.inference.ChiSquaredTest;

double[] expected = ...
long[] observed = ...
double alpha = 1e-3;

// Fail if we can *reject* the null hypothesis with confidence (1 - alpha)
// that the observed match the expected
if (ChiSquareTest.withDefaults().test(expected, observed).reject(alpha)) {
    // Significant deviation from the expected ...
}

Browse the Javadoc for more information.