Skip to content

Statistical Test Improvements #14

Description

@nandevers

The current code for statistical tests involves the following conditionals?

        if total_count > 0:
            if self.method=='chi2':
                try:
                    tstats, Praw = chisquare(counts_emp, f_exp=counts_exp)
                except:
                    raise Exception('The relative tolerance of the chisquare test is not reached. Try using another method such as "method=ks". This is not a bug but a feature: "https://github.com/scipy/scipy/issues/13362" ')
            elif self.method=='ks':
                tstats, Praw = ks_2samp(counts_emp, counts_exp)
            else:
                stats1, Praw1 = chisquare(counts_emp, f_exp=counts_exp)
                tstats2, Praw2 = ks_2samp(counts_emp, counts_exp)
                tstats, Praw = combine_pvalues([Praw1, Praw2], method='fisher')
                self.method = 'P_ensemble'

I have two proposals for this part of the code:

  1. Replace the conditionals for dictionary style, making the code more concise and less clutter of condition handling.
  2. Expand on the available tests by incorporating the suggestions from https://doi.org/10.3390/stats4020027 with appropriate disclamier for those who still want to use chi-squared tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions