Пример #1
0
    def test_posthoc_conover_friedman(self):

        results = sp.posthoc_conover_friedman(self.df_bn)
        p_results = np.array([[
            -1.000000, 0.935333, 0.268619, 0.339721, 0.339721, 0.060540,
            0.628079
        ],
                              [
                                  0.935333, -1.000000, 0.302605, 0.380025,
                                  0.380025, 0.070050, 0.685981
                              ],
                              [
                                  0.268619, 0.302605, -1.000000, 0.871144,
                                  0.871144, 0.380025, 0.519961
                              ],
                              [
                                  0.339721, 0.380025, 0.871144, -1.000000,
                                  1.000000, 0.302605, 0.628079
                              ],
                              [
                                  0.339721, 0.380025, 0.871144, 1.000000,
                                  -1.000000, 0.302605, 0.628079
                              ],
                              [
                                  0.060540, 0.070050, 0.380025, 0.302605,
                                  0.302605, -1.000000, 0.141412
                              ],
                              [
                                  0.628079, 0.685981, 0.519961, 0.628079,
                                  0.628079, 0.141412, -1.000000
                              ]])
        self.assertTrue(np.allclose(results, p_results))
Пример #2
0
    def test_posthoc_conover_friedman_tukey(self):

        results = sp.posthoc_conover_friedman(self.df_bn,
                                              p_adjust='single-step')
        p_results = np.array(
            [[1.0000000, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
             [1.0000000, 1.000000, np.nan, np.nan, np.nan, np.nan, np.nan],
             [0.8908193, 0.9212619, 1.000000, np.nan, np.nan, np.nan, np.nan],
             [
                 0.9455949, 0.9642182, 0.9999978, 1.000000, np.nan, np.nan,
                 np.nan
             ],
             [
                 0.9455949, 0.9642182, 0.9999978, 1.0000000, 1.000000, np.nan,
                 np.nan
             ],
             [
                 0.3177477, 0.3686514, 0.9642182, 0.9212619, 0.9212619,
                 1.000000, np.nan
             ],
             [
                 0.9986057, 0.9995081, 0.9931275, 0.9986057, 0.9986057,
                 0.6553018, 1.000000
             ]])
        p_results[p_results > 0.9] = 0.9
        tri_upper = np.triu_indices(p_results.shape[0], 1)
        p_results[tri_upper] = np.transpose(p_results)[tri_upper]
        np.fill_diagonal(p_results, 1)
        self.assertTrue(np.allclose(results, p_results, atol=3.e-2))
Пример #3
0
    def test_posthoc_conover_friedman_non_melted(self):

        df = DataFrame(self.df_bn)
        results = sp.posthoc_conover_friedman(df, melted=False)
        p_results = np.array([[
            1.000000, 0.9325836, 0.2497915, 0.3203414, 0.3203414, 0.0517417,
            0.6136576
        ],
                              [
                                  0.9325836, 1.000000, 0.28339156, 0.36072942,
                                  0.36072942, 0.06033626, 0.67344846
                              ],
                              [
                                  0.2497915, 0.28339156, 1.000000, 0.8657092,
                                  0.8657092, 0.3607294, 0.5026565
                              ],
                              [
                                  0.3203414, 0.36072942, 0.8657092, 1.000000,
                                  1.000000, 0.2833916, 0.6136576
                              ],
                              [
                                  0.3203414, 0.36072942, 0.8657092, 1.000000,
                                  1.000000, 0.2833916, 0.6136576
                              ],
                              [
                                  0.0517417, 0.06033626, 0.3607294, 0.2833916,
                                  0.2833916, 1.000000, 0.1266542
                              ],
                              [
                                  0.6136576, 0.67344846, 0.5026565, 0.6136576,
                                  0.6136576, 0.1266542, 1.000000
                              ]])
        self.assertTrue(np.allclose(results, p_results))
Пример #4
0
    def test_posthoc_conover_friedman(self):

        results = sp.posthoc_conover_friedman(self.df_bn)
        p_results = np.array([[
            -1.000000, 0.9325836, 0.2497915, 0.3203414, 0.3203414, 0.0517417,
            0.6136576
        ],
                              [
                                  0.9325836, -1.000000, 0.28339156, 0.36072942,
                                  0.36072942, 0.06033626, 0.67344846
                              ],
                              [
                                  0.2497915, 0.28339156, -1.000000, 0.8657092,
                                  0.8657092, 0.3607294, 0.5026565
                              ],
                              [
                                  0.3203414, 0.36072942, 0.8657092, -1.000000,
                                  1.000000, 0.2833916, 0.6136576
                              ],
                              [
                                  0.3203414, 0.36072942, 0.8657092, 1.000000,
                                  -1.000000, 0.2833916, 0.6136576
                              ],
                              [
                                  0.0517417, 0.06033626, 0.3607294, 0.2833916,
                                  0.2833916, -1.000000, 0.1266542
                              ],
                              [
                                  0.6136576, 0.67344846, 0.5026565, 0.6136576,
                                  0.6136576, 0.1266542, -1.000000
                              ]])
        self.assertTrue(np.allclose(results, p_results))