Ejemplo n.º 1
0
 def assertMatchesSciPy(self, distribution_a, distribution_b):
     our_u, our_p = mann_whitney(distribution_a, distribution_b)
     correct_u, correct_p = scipy_mann_whitney(
         self.frequencies_to_list(distribution_a),
         self.frequencies_to_list(distribution_b))
     self.assertEqual(our_u, correct_u, "U score incorrect")
     self.assertAlmostEqual(our_p, correct_p, msg="p value incorrect")
Ejemplo n.º 2
0
 def assertMatchesSciPy(self, distribution_a, distribution_b):
     our_u, our_p = mann_whitney(distribution_a, distribution_b)
     correct_u, correct_p = scipy_mann_whitney(
         self.frequencies_to_list(distribution_a),
         self.frequencies_to_list(distribution_b))
     self.assertEqual(our_u, correct_u, "U score incorrect")
     self.assertAlmostEqual(our_p, correct_p, msg="p value incorrect")
Ejemplo n.º 3
0
def mann_whitney_confidence(a_distribution, a_count, b_distribution, b_count):
    fixup_distribution(a_distribution, a_count)
    fixup_distribution(b_distribution, b_count)
    p_value = mann_whitney(a_distribution, b_distribution)[1]
    if p_value is not None:
        return (1 - p_value * 2) * 100 # Two tailed probability
    else:
        return None
Ejemplo n.º 4
0
def mann_whitney_confidence(a_distribution, a_count, b_distribution, b_count):
    fixup_distribution(a_distribution, a_count)
    fixup_distribution(b_distribution, b_count)
    p_value = mann_whitney(a_distribution, b_distribution)[1]
    if p_value is not None:
        return (1 - p_value * 2) * 100  # Two tailed probability
    else:
        return None
Ejemplo n.º 5
0
def mann_whitney_confidence(a_distribution, a_count, b_distribution, b_count):
    a_zeros = a_count - sum(a_distribution.values())
    a_distribution[0] = a_zeros
    b_zeros = b_count - sum(b_distribution.values())
    b_distribution[0] = b_zeros
    p_value = mann_whitney(a_distribution, b_distribution)[1]
    if p_value is not None:
        return (1 - p_value * 2) * 100 # Two tailed probability
    else:
        return None
Ejemplo n.º 6
0
 def test_empty_sets(self):
     mann_whitney(dict(), dict())
Ejemplo n.º 7
0
 def assertUandPCorrect(self, distribution_a, distribution_b, u, p):
     our_u, our_p = mann_whitney(distribution_a, distribution_b)
     self.assertEqual(our_u, u, "U score incorrect")
     self.assertAlmostEqual(our_p, p, msg="p value incorrect")
Ejemplo n.º 8
0
 def test_empty_sets(self):
     mann_whitney(dict(), dict())
 def assertUandPCorrect(self, distribution_a, distribution_b, u, p):
     our_u, our_p = mann_whitney(distribution_a, distribution_b)
     self.assertEqual(our_u, u, "U score incorrect")
     self.assertAlmostEqual(our_p, p, msg="p value incorrect")