Exemplo n.º 1
0
 def test_G_ind_with_pseudocount(self):
     """G test of independence with pseudocount"""
     table = CategoryCounts([[762, 327, 0], [484, 239, 0]])
     got = table.G_independence(williams=True, pseudo_count=1)
     assert_allclose(table.observed.array + 1, got.observed.array)
     assert_allclose(got.expected.array, calc_expected(got.observed.array))
Exemplo n.º 2
0
 def test_calc_expected2(self):
     """handle case where expected is a single column vector"""
     nums = numpy.array([1, 2, 3]).reshape((3, 1))
     got = calc_expected(nums)
     assert_allclose(got, numpy.array([2, 2, 2]).reshape((3, 1)))