[Mne_analysis] Spatiotemporal cluster permutation on evoked data in a within subjects design

JR KING jeanremi.king at gmail.com
Wed Jan 17 14:07:52 EST 2018
Search archives:

Hi Rasha,

1. I'm not sure I follow your script. We don't have an rms_grad function,
but I guess you're taking the root mean square across gradiometers. If so,
the shape of X_tmp should be 2D (17 x n_times) not 3D (17 * 101 * 102 in
your script), shouldn't it?

2. I think the correct way to do the within subject analysis you mention is
to use mne.stats.spatio_temporal_cluster_1samp_test: i.e. first you
subtract the two condition within subject, second you run the permutations
spatio_temporal_cluster_1samp_test(X[:17]-X[17:])

Hope that helps,

Jean-Rémi

On 17 January 2018 at 11:34, Rasha Hyder <rasha.hyder12 at gmail.com> wrote:

> Hi all,
>
> I'm trying to run spatiotemporal cluster permutation on evoked responses
> in a within subjects design where each subject is observed in two
> conditions: cond1 and cond2:
>
> to do so I'm using the following:
>
> # for 17 subjects and 100 ms time window
>
> conditions= [cond1, cond2]
> for j, cond in enumerate(conditions):
>     X_tmp = np.zeros((17, 101, 102))
>
>     for i, subject in enumerate(subjects):
>         evoked = mne.read_evokeds(fname)
>         grads= evoked.pick_types(meg="grad")
>         rms = rms_grad(grads.data)
>         X_tmp[i, :] = np.transpose(rms)
>
>     if j == 0:
>         X = X_tmp
>     else:
>         X = np.vstack((X, X_tmp))
>
> connectivity, ch_names = find_ch_connectivity(evoked.info, ch_type='mag')
>
> T_obs, clusters, p_values, _ = spatio_temporal_cluster_test([X[:17],
> X[17:]],
>                                                     n_permutations=5000,
>                                                     tail=0,
>                                                     n_jobs=2,
>
> connectivity=connectivity)
>
> After around 20 mints of running the script, the returned p_values look
> like this:
>
> p_values
> Out[68]:
> array([ 0.9476,  1.    ,  1.    ,  0.8854,  1.    ,  1.    ,  0.9966,
>         1.    ,  1.    ,  1.    ,  1.    ,  1.    ,  0.9974,  1.    ,
>         1.    ,  1.    ,  1.    ,  1.    ])
>
> My question is, given the input data: [X[:17], X[17:]] where:
> X[17:] contains the data observed in cond1 from all 17 subjects and
> similarly X[17:] is the data observed in cond2.
>
> are the permutations in this case done between cond1 and cond2 within the
> same subject (as should be) or randomly between subjects?
>
> Many thanks in advance
>
> Rasha
>
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_-8311896079980075393_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180117/bb96c892/attachment-0001.html 


More information about the Mne_analysis mailing list