Beispiel #1
0
    def setUp(self) -> None:
        self.bonferroni = ComparisonsCorrection("bonferroni")

        self.bonferroni_manual = ComparisonsCorrection(
            partial(multipletests, method="bonferroni"),
            name="Bonferroni (manual)",
            method_type=0)
Beispiel #2
0
    def setUp(self) -> None:
        self.benjamini_hochberg = ComparisonsCorrection("Benjamini-Hochberg")
        self.benjamini_hochberg_006 = ComparisonsCorrection(
            "Benjamini-Hochberg", alpha=0.06)

        self.benjamini_hochberg_006_man_diff_api = ComparisonsCorrection(
            self.my_bh_from_sm,
            name="Benjamini-Hochberg (manual)",
            method_type=1,
            statsmodels_api=False)
Beispiel #3
0
    def setUp(self) -> None:
        self.holm_bonferroni = ComparisonsCorrection("holm")
        self.holm_bonferroni_006 = ComparisonsCorrection("holm", alpha=0.06)

        self.holm_bonferroni_006_manual = ComparisonsCorrection(
            partial(multipletests, method="holm"),
            name="Holm-Bonferroni (manual)",
            method_type=1,
            corr_kwargs={"alpha": 0.06})

        self.holm_bonferroni_006_manual_bis = ComparisonsCorrection(
            partial(multipletests, method="holm", alpha=0.06),
            name="Holm-Bonferroni (manual)",
            method_type=1)
Beispiel #4
0
 def test_signif_with_type1_correction_star_replace(self):
     bh = ComparisonsCorrection("BH")
     self.annotator.configure(comparisons_correction=bh,
                              correction_format="replace")
     self.annotator.set_pvalues(self.pvalues)
     self.assertEqual(["ns", "ns", "ns"],
                      self.annotator.get_annotations_text())
Beispiel #5
0
    def test_signif_with_type0_correction_star(self):
        bonferroni = ComparisonsCorrection("bonferroni")
        self.annotator.configure(comparisons_correction=bonferroni)

        self.annotator.set_pvalues(self.pvalues)

        self.assertEqual(["ns", "ns", "ns"],
                         self.annotator.get_annotations_text())
Beispiel #6
0
 def setUp(self) -> None:
     self.benjamini_hochberg = ComparisonsCorrection("Benjamini-Hochberg")
     self.stat_result = StatResult("Test X",
                                   "X",
                                   "Stat",
                                   1,
                                   0.02,
                                   alpha=0.05)
     self.stat_result.correction_method = self.benjamini_hochberg.name
Beispiel #7
0
    def test_signif_with_type1_correction_simple(self):
        bh = ComparisonsCorrection("BH")
        self.annotator.configure(comparisons_correction=bh,
                                 pvalue_format={'text_format': 'simple'})
        self.annotator.set_pvalues(self.pvalues)

        expected = ["p ≤ 0.05 (ns)", "p ≤ 0.05 (ns)", "p = 0.90"]

        self.assertEqual(expected, self.annotator.get_annotations_text())
Beispiel #8
0
    def test_signif_with_type0_correction_simple(self):
        bonferroni = ComparisonsCorrection("bonferroni")
        self.annotator.configure(comparisons_correction=bonferroni,
                                 pvalue_format={'text_format': 'simple'})

        self.annotator.set_pvalues(self.pvalues)

        expected = ["p = 0.09", "p = 0.12", "p = 1.00"]

        self.assertEqual(expected, self.annotator.get_annotations_text())
Beispiel #9
0
 def test_signif_with_type1_correction_star_abnormal_num_comparisons(self):
     bh = ComparisonsCorrection("BH")
     self.annotator.configure(comparisons_correction=bh)
     with self.assertWarnsRegex(UserWarning, "Manually-specified"):
         self.annotator.set_pvalues(self.pvalues, num_comparisons=1)
Beispiel #10
0
 def test_signif_with_type1_correction_star_incorrect_num_comparisons(self):
     bh = ComparisonsCorrection("BH")
     self.annotator.configure(comparisons_correction=bh)
     with self.assertRaisesRegex(ValueError, "positive"):
         self.annotator.set_pvalues(self.pvalues, num_comparisons=0)
Beispiel #11
0
 def test_signif_with_type1_correction_star(self):
     bh = ComparisonsCorrection("BH")
     self.annotator.configure(comparisons_correction=bh)
     self.annotator.set_pvalues(self.pvalues)
     self.assertEqual(["* (ns)", "* (ns)", "ns"],
                      self.annotator.get_annotations_text())
Beispiel #12
0
 def test_raises_not_implemented(self):
     with self.assertRaises(NotImplementedError):
         ComparisonsCorrection('that method')