Beispiel #1
0
 def testBasic(self):
     self.assertAlmostEqual(
         mann_whitney_u.MannWhitneyU(range(10), range(20, 30)),
         0.00018267179110955002)
     self.assertAlmostEqual(
         mann_whitney_u.MannWhitneyU(range(5), range(10)),
         0.13986357686781267)
Beispiel #2
0
def _CompareValues(values_a, values_b):
    if not (values_a and values_b):
        return _UNKNOWN

    try:
        p_value = mann_whitney_u.MannWhitneyU(values_a, values_b)
    except ValueError:
        return _UNKNOWN

    if p_value < _SIGNIFICANCE_LEVEL:
        return _DIFFERENT
    else:
        return _UNKNOWN
Beispiel #3
0
def _CompareResults(results_a, results_b):
    if len(results_a) == 0 or len(results_b) == 0:
        return _UNKNOWN

    try:
        p_value = mann_whitney_u.MannWhitneyU(results_a, results_b)
    except ValueError:
        return _UNKNOWN

    if p_value < _SIGNIFICANCE_LEVEL:
        return _DIFFERENT
    else:
        return _UNKNOWN
Beispiel #4
0
 def testAllValuesIdentical(self):
     with self.assertRaises(ValueError):
         mann_whitney_u.MannWhitneyU([0] * 5, [0] * 5)
Beispiel #5
0
 def testSmallSamples(self):
     self.assertEqual(mann_whitney_u.MannWhitneyU([0], [1]), 1.0)
Beispiel #6
0
 def testDuplicateValues(self):
     self.assertAlmostEqual(mann_whitney_u.MannWhitneyU([0] * 5, [1] * 5),
                            0.0039767517097886512)