Exemplo n.º 1
0
 def test_weighted_contingency(self):
     x = np.array([0, 1, 0, 2, np.nan])
     y = np.array([0, 0, 1, np.nan, 0])
     w = np.array([1, 2, 2, 3, 4])
     cont_table, nans = contingency(x, y, 2, 2, weights=w)
     np.testing.assert_equal(cont_table, [[1, 2, 0], [2, 0, 0], [0, 0, 0]])
     np.testing.assert_equal(nans, [1, 0, 0])
Exemplo n.º 2
0
 def test_contingency(self):
     x = np.array([0, 1, 0, 2, np.nan])
     y = np.array([0, 0, 1, np.nan, 0])
     cont_table, nans = contingency(x, y, 2, 2)
     np.testing.assert_equal(cont_table, [[1, 1, 0],
                                          [1, 0, 0],
                                          [0, 0, 0]])
     np.testing.assert_equal(nans, [1, 0, 0])
Exemplo n.º 3
0
 def test_contingency(self):
     x = np.array([0, 1, 0, 2, np.nan])
     y = np.array([0, 0, 1, np.nan, 0])
     cont_table, nans = contingency(x, y, 2, 2)
     np.testing.assert_equal(cont_table, [[1, 1, 0],
                                          [1, 0, 0],
                                          [0, 0, 0]])
     np.testing.assert_equal(nans, [1, 0, 0])
Exemplo n.º 4
0
 def test_contingency(self):
     x = np.array([0, 1, 0, 2, np.nan, np.nan])
     y = np.array([0, 0, 1, np.nan, 0, np.nan])
     cont_table, col_nans, row_nans, nans = contingency(x, y, 2, 2)
     np.testing.assert_equal(cont_table, [[1, 1, 0], [1, 0, 0], [0, 0, 0]])
     np.testing.assert_equal(col_nans, [1, 0, 0])
     np.testing.assert_equal(row_nans, [0, 0, 1])
     self.assertEqual(1, nans)
Exemplo n.º 5
0
 def test_weighted_contingency(self):
     x = np.array([0, 1, 0, 2, np.nan])
     y = np.array([0, 0, 1, np.nan, 0])
     w = np.array([1, 2, 2, 3, 4])
     cont_table, nans = contingency(x, y, 2, 2, weights=w)
     np.testing.assert_equal(cont_table, [[1, 2, 0],
                                          [2, 0, 0],
                                          [0, 0, 0]])
     np.testing.assert_equal(nans, [1, 0, 0])
Exemplo n.º 6
0
 def test_weighted_contingency(self):
     x = np.array([0, 1, 0, 2, np.nan, np.nan])
     y = np.array([0, 0, 1, np.nan, 0, np.nan])
     w = np.array([1, 2, 2, 3, 4, 2])
     cont_table, col_nans, row_nans, nans = contingency(x,
                                                        y,
                                                        2,
                                                        2,
                                                        weights=w)
     np.testing.assert_equal(cont_table, [[1, 2, 0], [2, 0, 0], [0, 0, 0]])
     np.testing.assert_equal(col_nans, [4, 0, 0])
     np.testing.assert_equal(row_nans, [0, 0, 3])
     self.assertEqual(2, nans)