Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorize significance testing, support more flexibility #7

Open
henrymj opened this issue May 31, 2023 · 0 comments
Open

Vectorize significance testing, support more flexibility #7

henrymj opened this issue May 31, 2023 · 0 comments

Comments

@henrymj
Copy link
Contributor

henrymj commented May 31, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant