[Mne_analysis] [Mne analysis] two sample t-test with spatio_temporal_cluster_test

Denis-Alexander Engemann denis.engemann at gmail.com
Mon Jun 12 17:45:45 EDT 2017
Search archives:

That does not look obviously wrong. Does it work?
On Tue, 13 Jun 2017 at 00:43, Talitha Ford <tcford at swin.edu.au> wrote:

> Thanks Dennis, I had included a ttest as the stat_fun in the previous
> command, though.
>
> From what I understand, for a ttest, my code should look more like this:
>
> #~ X1= np.abs(X1)
> #~ X2 np.abs(X2)
>
> print('Computing connectivity.')
> connectivity = spatial_tris_connectivity(grade_to_tris(5))
>
> #    Note that X needs to be a list of multi-dimensional array of shape
> #    samples (subjects_k) x time x space, so we permute dimensions
> X1 = np.transpose(X1, [2,1,0])
> X2 = np.transpose(X2, [2,1,0])
> all_data = [X2, X1]
>
> p_threshold = 0.0001
>
> #~ f_threshold = stats.distributions.f.ppf(1. - p_threshold / 2.,
>     #~ len(X2) - 1, len(X1) - 1)
>
> t_threshold = stats.distributions.t.ppf(p_threshold / 2.,
>     len(X2) - 1, len(X1) - 1)
>
> print('Clustering.')
> T_obs, clusters, cluster_p_values, H0 = clu =\
> spatio_temporal_cluster_test(all_data, connectivity=connectivity,
> n_jobs=2, threshod= t_threshold, stat_fun= scipy.stats.ttest_ind)
>
> Commenting out the conversation of the data to absolute values,
> calculating a t_threshold, and including ttest_ind as the stat_fun? Sorry
> if I have misunderstood something.
>
> Thanks,
> Talitha
>
>
>
> On 12 Jun 2017, at 17:27, Denis-Alexander Engemann <
> denis.engemann at gmail.com> wrote:
>
> Ahh. For two conditions F should be the abs(T**2). You can just use a
> t-test for indpendent samples here instead as statfun.
> On Mon, 12 Jun 2017 at 10:13, Talitha Ford <tcford at swin.edu.au> wrote:
>
>> Hi Dennis,
>> Thank you, this is the script I’ve been working from. The problem I am
>> having though, is that as f-stats are >0, they do not indicate which group
>> is larger than the other, which is what I would like to know. I have tried
>> to use scipy.stats.ttest_ind but I get this error:
>> ValueError: could not broadcast input array from shape (1000) into shape
>> (614520)
>>
>> The command is:
>>  T_obs, clusters, cluster_p_values, H0 = clu =\
>> spatio_temporal_cluster_test(all_data, connectivity=connectivity,
>> n_jobs=2, stat_fun= scipy.stats.ttest_ind)
>>
>> all_data is 2 lists (2 groups) of 16 and 19 participants, with 30 time
>> points of 20484 vertices for each participant.
>>
>> I hope that makes sense (and there is a possible work around!). Thanks
>> again for you help,
>>
>> Talitha
>>
>>
>> On 12 Jun 2017, at 05:33, Denis-Alexander Engemann <
>> denis.engemann at gmail.com> wrote:
>>
>> Hi Talitha,
>>
>> you can run the permutation clustering with a wide array of contrasts.
>> This might be what you are looking for:
>>
>>
>> http://martinos.org/mne/dev/auto_tutorials/plot_stats_cluster_spatio_temporal_2samp.html
>>
>> I hope this helps,
>> Denis
>>
>> On Sun, Jun 11, 2017 at 12:00 PM Talitha Ford <tcford at swin.edu.au> wrote:
>>
>>> Dear all,
>>>
>>> Similar to conducing a pair samples t-test on source data using
>>> spatio-temporal clustering, allowing the visualisation of clusters where
>>> condition A > condition B and vice versa, is it possible to run an
>>> independent samples t-test to visualise differences between two groups? The
>>> 2 samples permutation tests currently available are limited in that they
>>> plot F statistics that don’t give a direction of the difference between the
>>> groups. Basically, is it possible to identify clusters that differ
>>> significantly between the groups, as well as identify/visualise the
>>> direction in which they differ?
>>>
>>> I am currently attempting to extract the cluster values for each
>>> participant to get an overall mean for each vertex within the cluster to
>>> compare between groups, but this seems very inefficient.
>>>
>>> Cheers,
>>> Talitha
>>>
>>> _______________________________________________
>>> 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.
>>>
>> _______________________________________________
>> 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.
>>
>> _______________________________________________
>> 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.
>>
> _______________________________________________
> 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.
>
> _______________________________________________
> 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/20170612/ff8e8969/attachment.html 


More information about the Mne_analysis mailing list