Skip to content

Vectorize significance testing, support more flexibility #7

@henrymj

Description

@henrymj
if significance_testing:
                p = np.zeros(len(self.t[self.t > 0]))
                # only test on timepoints after stimulus onset
                for i, t in enumerate(np.arange(len(self.t))[self.t > 0]):
                    # one-sided paired ttest
                    _, p[i] = sista.ttest_rel(
                        a=acc[t], b=acc_shuff[t], alternative='greater')
                # Use Benjamini-Hochberg procedure for multiple comparisons, defaults to FDR of .05
                _, corrected_p, _, _ = multipletests(p, method='fdr_bh')
                sig05 = corrected_p < .05

I think this should be pulled out into its own function that allows for specifying alternatives and correction methods.

I also want to note that scipy lets you test along an axis, and the following should work:

p = sista.ttest_rel(a=acc, b=acc_shuff, axis=0, alternative='greater').pvalue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions