Created
June 5, 2015 13:27
-
-
Save kingjr/92708f36cd2f39a70b4c to your computer and use it in GitHub Desktop.
Example TFCE stats for GAT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| from mne.stats import spatio_temporal_cluster_1samp_test | |
| # Gather all scores | |
| scores = np.array([gat.scores_ for gat in gat_list]) | |
| gat_mean = copy.deepcopy(gat_list[0]) | |
| gat_mean.scores_ = np.mean(scores, axis=0) | |
| # STATS | |
| chance = 0.5 # chance level; if it's an AUC, it has to be .5 | |
| alpha = 0.05 | |
| T_obs_, clusters, p_values, _ = spatio_temporal_cluster_1samp_test( | |
| scores - chance, out_type='mask', n_permutations=128, | |
| threshold=dict(start=2, step=2.), n_jobs=-1) | |
| p_values = p_values.reshape(scores.shape[1:]) | |
| # PLOT | |
| fig = gat_mean.plot(show=False) | |
| ax = fig.axes[0] | |
| xx, yy = np.meshgrid(gat_mean.train_times_['times'], | |
| gat_mean.test_times_['times'][0], | |
| copy=False, indexing='xy') | |
| ax.contour(xx, yy, p_values < alpha, colors='black', levels=[0]) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment