[Mne_analysis] mixed design ANOVA with spatio-temporal clustering
Talitha Ford
tcford at swin.edu.au
Mon Mar 6 23:50:04 EST 2017
Hi again,
My apologies, I found the source of the first value error, however now I have this one:
ValueError: bad axis1 argument to swapaxes
which I am quite sure is related to the uneven groups.
Here is the full error message:
n_permutations = 128
print('Clustering.')
T_obs, clusters, cluster_p_values, H0 = clu = \
spatio_temporal_cluster_test(all_data, connectivity=connectivity, n_jobs=2,
threshold=f_threshold, stat_fun=stat_fun,
n_permutations=n_permutations,
buffer_size=None) # clu is an array of T_obs, clusters, cluster_p_values, H0
## -- End pasted text –
Clustering.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-30-377c44f3e5a4> in <module>()
5 threshold=f_threshold, stat_fun=stat_fun,
6 n_permutations=n_permutations,
----> 7 buffer_size=None) # clu is an array of T_obs, clusters, cluster_p_values, H0
/Users/tcford/anaconda/lib/python2.7/site-packages/mne/stats/cluster_level.pyc in spatio_temporal_cluster_test(X, threshold, n_permutations, tail, stat_fun, connectivity, verbose, n_jobs, seed, max_step, spatial_exclude, step_down_p, t_power, out_type, check_disjoint, buffer_size)
/Users/tcford/anaconda/lib/python2.7/site-packages/mne/utils.pyc in verbose(function, *args, **kwargs)
706 with use_log_level(verbose_level):
707 return function(*args, **kwargs)
--> 708 return function(*args, **kwargs)
709
710
/Users/tcford/anaconda/lib/python2.7/site-packages/mne/stats/cluster_level.pyc in spatio_temporal_cluster_test(X, threshold, n_permutations, tail, stat_fun, connectivity, verbose, n_jobs, seed, max_step, spatial_exclude, step_down_p, t_power, out_type, check_disjoint, buffer_size)
1414 t_power=t_power, out_type=out_type,
1415 check_disjoint=check_disjoint,
-> 1416 buffer_size=buffer_size)
1417 return out
1418
/Users/tcford/anaconda/lib/python2.7/site-packages/mne/stats/cluster_level.pyc in permutation_cluster_test(X, threshold, n_permutations, tail, stat_fun, connectivity, verbose, n_jobs, seed, max_step, exclude, step_down_p, t_power, out_type, check_disjoint, buffer_size)
/Users/tcford/anaconda/lib/python2.7/site-packages/mne/utils.pyc in verbose(function, *args, **kwargs)
706 with use_log_level(verbose_level):
707 return function(*args, **kwargs)
--> 708 return function(*args, **kwargs)
709
710
/Users/tcford/anaconda/lib/python2.7/site-packages/mne/stats/cluster_level.pyc in permutation_cluster_test(X, threshold, n_permutations, tail, stat_fun, connectivity, verbose, n_jobs, seed, max_step, exclude, step_down_p, t_power, out_type, check_disjoint, buffer_size)
1025 t_power=t_power, out_type=out_type,
1026 check_disjoint=check_disjoint,
-> 1027 buffer_size=buffer_size)
1028
1029
/Users/tcford/anaconda/lib/python2.7/site-packages/mne/stats/cluster_level.pyc in _permutation_cluster_test(X, threshold, n_permutations, tail, stat_fun, connectivity, verbose, n_jobs, seed, max_step, exclude, step_down_p, t_power, out_type, check_disjoint, buffer_size)
/Users/tcford/anaconda/lib/python2.7/site-packages/mne/utils.pyc in verbose(function, *args, **kwargs)
706 with use_log_level(verbose_level):
707 return function(*args, **kwargs)
--> 708 return function(*args, **kwargs)
709
710
/Users/tcford/anaconda/lib/python2.7/site-packages/mne/stats/cluster_level.pyc in _permutation_cluster_test(X, threshold, n_permutations, tail, stat_fun, connectivity, verbose, n_jobs, seed, max_step, exclude, step_down_p, t_power, out_type, check_disjoint, buffer_size)
710 # Step 1: Calculate T-stat for original data
711 # -------------------------------------------------------------
--> 712 T_obs = stat_fun(*X)
713 logger.info('stat_fun(H1): min=%f max=%f' % (np.min(T_obs), np.max(T_obs)))
714
<ipython-input-22-27a09a4d2798> in stat_fun(*args)
16
17 def stat_fun(*args):
---> 18 return f_mway_rm(np.swapaxes(args, 1, 0), factor_levels=factor_levels,
19 effects=effects, return_pvals=return_pvals)[0]
20 # get f-values only.
/Users/tcford/anaconda/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in swapaxes(a, axis1, axis2)
500 swapaxes = a.swapaxes
501 except AttributeError:
--> 502 return _wrapit(a, 'swapaxes', axis1, axis2)
503 return swapaxes(axis1, axis2)
504
/Users/tcford/anaconda/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in _wrapit(obj, method, *args, **kwds)
45 except AttributeError:
46 wrap = None
---> 47 result = getattr(asarray(obj), method)(*args, **kwds)
48 if wrap:
49 if not isinstance(result, mu.ndarray):
ValueError: bad axis1 argument to swapaxes
Any help would be greatly appreciated,
Talitha
From: <mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of Talitha Ford <tcford at swin.edu.au>
Reply-To: Discussion and support forum for the users of MNE Software <mne_analysis at nmr.mgh.harvard.edu>
Date: Tuesday, 7 March 2017 at 15:14
To: "mne_analysis at nmr.mgh.harvard.edu" <mne_analysis at nmr.mgh.harvard.edu>
Subject: [Mne_analysis] mixed design ANOVA with spatio-temporal clustering
Hi all,
First off, thanks for the new repeated measure ANOVA capability in spatio-temporal cluster analysis!
I’d like to adapt this script for my data, however it is a 2(between-group) by 2(within-group) mixed design. Unfortunately the groups are uneven, so even if I enter the groups data as if they are a within-subjects factors I get an error (at least that’s how I’m interpreting the ValueError: total size of new array must be unchanged).
The shape (subs, time, vertices) of my groups are:
grp1 (16, 151, 20484)
grp2 (20,151,20484)
Is there a mixed design ANOVA alternative?
Talitha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170307/f5a6b2ce/attachment-0001.html
More information about the Mne_analysis
mailing list