def test_unweighted_t_test(self): expected_p_values = [[1., 0.00353093, 1., 0.00961514], [0.00353093, 1., 0.00353093, 0.43711409], [1., 0.00353093, 1., 0.00961514], [0.00961514, 0.43711409, 0.00961514, 1.]] expected_scores = [[0., -3.38132124, 0., -2.88675135], [3.38132124, 0., 3.38132124, 0.78881064], [0., -3.38132124, 0., -2.88675135], [2.88675135, -0.78881064, 2.88675135, 0.]] p_values, scores = comstats.t_test(self.input_set) self.assertTrue((p_values.round(8) == expected_p_values).all()) self.assertTrue((scores.round(8) == expected_scores).all())
def test_unweighted_t_test_equal_variance_one_sided(self): expected_p_values = [[0.5, 0.00107162, 0.5, 0.00370951], [0.00107162, 0.5, 0.00107162, 0.21842554], [0.5, 0.00107162, 0.5, 0.00370951], [0.00370951, 0.21842554, 0.00370951, 0.5]] expected_scores = [[0., -3.38132124, 0., -2.88675135], [3.38132124, 0., 3.38132124, 0.78881064], [0., -3.38132124, 0., -2.88675135], [2.88675135, -0.78881064, 2.88675135, 0.]] p_values, scores = comstats.t_test(self.input_set, None, { 'paired': False, 'equal_variance': True }, True) self.assertTrue((p_values.round(8) == expected_p_values).all()) self.assertTrue((scores.round(8) == expected_scores).all())
def test_unweighted_t_test_equal_variance(self): expected_p_values = [[1., 0.00214325, 1., 0.00741902], [0.00214325, 1., 0.00214325, 0.43685108], [1., 0.00214325, 1., 0.00741902], [0.00741902, 0.43685108, 0.00741902, 1.]] expected_scores = [[0., -3.38132124, 0., -2.88675135], [3.38132124, 0., 3.38132124, 0.78881064], [0., -3.38132124, 0., -2.88675135], [2.88675135, -0.78881064, 2.88675135, 0.]] p_values, scores = comstats.t_test(self.input_set, None, { 'paired': False, 'equal_variance': True }, False) self.assertTrue((p_values.round(8) == expected_p_values).all()) self.assertTrue((scores.round(8) == expected_scores).all())
def test_paired_t_test_one_sided(self): expected_p_values = [[0.5, 0.00142342, 0.5, 0.00084464], [0.00142342, 0.5, 0.00473445, 0.2121376], [0.5, 0.00473445, 0.5, 0.00799931], [0.00084464, 0.2121376, 0.00799931, 0.5]] expected_scores = [[0., -3.60906033, 0., -3.87298335], [3.60906033, 0., 3.00438276, 0.82305489], [0., -3.00438276, 0., -2.73861279], [3.87298335, -0.82305489, 2.73861279, 0.]] p_values, scores = comstats.t_test(self.input_set, None, { 'paired': True, 'equal_variance': False }, True) self.assertTrue((p_values.round(8) == expected_p_values).all()) self.assertTrue((scores.round(8) == expected_scores).all())
def test_paired_t_test(self): expected_p_values = [[1, 0.00284684, 1., 0.00168927], [0.00284684, 1, 0.00946889, 0.4242752], [1., 0.00946889, 1, 0.01599862], [0.00168927, 0.4242752, 0.01599862, 1]] expected_scores = [[0, -3.60906033, 0., -3.87298335], [3.60906033, 0, 3.00438276, 0.82305489], [0., -3.00438276, 0, -2.73861279], [3.87298335, -0.82305489, 2.73861279, 0]] p_values, scores = comstats.t_test(self.input_set, None, { 'paired': True, 'equal_variance': False }) self.assertTrue((p_values.round(8) == expected_p_values).all()) self.assertTrue((scores.round(8) == expected_scores).all())
def test_weighted_t_test_one_sided(self): expected_p_values = [ [5.00000000e-01, 7.10380000e-04, 2.55154190e-01, 3.68701500e-02], [7.10380000e-04, 5.00000000e-01, 3.28580000e-04, 4.43833800e-02], [2.55154190e-01, 3.28580000e-04, 5.00000000e-01, 1.67995300e-02], [3.68701500e-02, 4.43833800e-02, 1.67995300e-02, 5.00000000e-01] ] expected_scores = [[0., -3.53992642, 0.66687841, -1.85781692], [3.53992642, 0., 3.83253879, 1.76327075], [-0.66687841, -3.83253879, 0., -2.23466985], [1.85781692, -1.76327075, 2.23466985, 0.]] p_values, scores = comstats.t_test(self.input_set, self.weights, { 'paired': False, 'equal_variance': False }, True) self.assertTrue((p_values.round(8) == expected_p_values).all()) self.assertTrue((scores.round(8) == expected_scores).all())
def test_weighted_t_test(self): expected_p_values = [ [1.00000000e+00, 1.42077000e-03, 5.10308380e-01, 7.37402900e-02], [1.42077000e-03, 1.00000000e+00, 6.57160000e-04, 8.87667500e-02], [5.10308380e-01, 6.57160000e-04, 1.00000000e+00, 3.35990600e-02], [7.37402900e-02, 8.87667500e-02, 3.35990600e-02, 1.00000000e+00] ] expected_scores = [[0., -3.53992642, 0.66687841, -1.85781692], [3.53992642, 0., 3.83253879, 1.76327075], [-0.66687841, -3.83253879, 0., -2.23466985], [1.85781692, -1.76327075, 2.23466985, 0.]] p_values, scores = comstats.t_test(self.input_set, self.weights, { 'paired': False, 'equal_variance': False }) self.assertTrue((p_values.round(8) == expected_p_values).all()) self.assertTrue((scores.round(8) == expected_scores).all())