public Result test()

in commons-statistics-inference/src/main/java/org/apache/commons/statistics/inference/MannWhitneyUTest.java [275:301]


    public Result test(double[] x, double[] y) {
        // Computation as above. The ranks are required for tie correction.
        checkSamples(x, y);
        final double[] z = concatenateSamples(mu, x, y);
        final double[] ranks = RANKING.apply(z);
        final double sumRankX = Arrays.stream(ranks).limit(x.length).sum();
        final double u1 = sumRankX - ((long) x.length * (x.length + 1)) * 0.5;

        final double c = WilcoxonSignedRankTest.calculateTieCorrection(ranks);
        final boolean tiedValues = c != 0;

        PValueMethod method = pValueMethod;
        final int n = x.length;
        final int m = y.length;
        if (method == PValueMethod.AUTO && Math.max(n, m) < AUTO_LIMIT) {
            method = PValueMethod.EXACT;
        }
        // Exact p requires no ties.
        // The method will fail-fast if the computation is not possible due
        // to the size of the data.
        double p = method == PValueMethod.EXACT && !tiedValues ?
            calculateExactPValue(u1, n, m, alternative) : -1;
        if (p < 0) {
            p = calculateAsymptoticPValue(u1, n, m, c);
        }
        return new Result(u1, tiedValues, p);
    }