Exemplo n.º 1
0
    def test_hartigan_diptest_for_modality(self):
        """
        Ensure that the package runs Fisher exact if cell counts are <=5 and it's a 2x2
        """
        dist_1_peak = modality.generate_data(peaks=1, n=[10000])
        t1 = modality.hartigan_diptest(dist_1_peak)
        assert t1 > 0.95

        dist_2_peak = modality.generate_data(peaks=2, n=[10000, 10000])
        t2 = modality.hartigan_diptest(dist_2_peak)
        assert t2 < 0.05

        dist_3_peak = modality.generate_data(peaks=3, n=[10000, 10000, 10000])
        t3 = modality.hartigan_diptest(dist_3_peak)
        assert t3 < 0.05
Exemplo n.º 2
0
    def _diptest(self, x):
        """
        Compute Hartigan Dip Test for modality.

        p < 0.05 suggests possible multimodality.
        """
        return modality.hartigan_diptest(x.values)
Exemplo n.º 3
0
    def _diptest(self,x):
        """
        Compute Hartigan Dip Test for modality.

        p < 0.05 suggests possible multimodality.
        """
        p = modality.hartigan_diptest(x.values)
        # dropna=False argument in pivot_table does not function as expected
        # return -1 instead of None
        if pd.isnull(p):
            return -1
        return p
Exemplo n.º 4
0
    def test_hartigan_diptest(self):
        t0 = time.time()
        hartigan_diptest(self.data)
        t1 = time.time()

        print("Hartigan diptest: {}".format(t1-t0))