[Mne_analysis] plot_cluster_stats_spatio_temporal

Eric Larson larson.eric.d at gmail.com
Wed Jan 8 18:47:00 EST 2014
Search archives:

The only stats "tutorial" type thing I have is the example on TFCE + hat in
the docs, which you've presumably seen. It's possible Alex or Denis has
given some sort of tutorial or knows about some slides...?

If you want reading that's well grounded mathematically, I know that Hari
Bharadwaj has some slides available from a lecture he gave:

http://nmr.mgh.harvard.edu/whynhow/HB_WhyNHow_Stats_Feb7_2013.pdf

It's realistically outside the scope of `mne-python` to provide users with
access to all statistical functions, since then we'd be replicating
something like R(py) or SPSS in our software. We've tried to provide some
of the most broadly useful examples (ttest_1samp and f_oneway) to get
people started, with mechanisms that allow them to build arbitrary
contrasts of their own (hopefully).

Building your own `stat_fun` would make a good introduction into the python
world. Go ahead and open an issue on GitHub and one of us can probably help
you along if you get stuck. If your code / `stat_fun` ends up being a
broadly applicable enhancement to the package, then we can work on
including it. The issue can also serve as the proper venue for discussing
inclusion, lest we bore the mne_analysis readership :)

Eric



On Wed, Jan 8, 2014 at 3:30 PM, Matt Erhart <merhart at ucsd.edu> wrote:

> I actually already have that 2samp example working on my data, but I used
> two conditions in one group instead of two groups of subjects just to get
> it working. I started with the 2samp because the structure was what I was
> familiar with coming from matlab's ttest functions, i.e. pass both
> conditions instead of a subtraction. Is there a way to easily modify the
> 2samp example to be valid with a 1samp situation? I tried
> stat_fun=scipy.stats.ttest_rel, but it looks like I need to create a series
> of my own functions as you have with f_oneway.
>
> I should mention that I've done everything in matlab/fieldtrip so far, and
> I am learning python in order to get these cluster methods working on our
> data (in source space), so it will take some effort to put together my own
> stat_fun.
>
> I am happy to open a issue on github. The primary goal of the issue would
> be to get cluster with TFCE with "hat" working in a 1 or 2 sample
> situation, so I can use the same method for my group and condition
> comparisons if that's possible. Should I add that to the issue page with an
> ENH tag?
>
> Are there any resources (such as powerpoint slides from a talk) that
> explain the clustering used here from the ground up?
>
> thanks,
> Matt
>
>
>
>
>
>
>
>
>
> On Wed, Jan 8, 2014 at 11:53 AM, Eric Larson <larson.eric.d at gmail.com>wrote:
>
>> Hey Matt,
>>
>> The statistical functions are designed to accommodate different
>> statistical measures on their inputs. See if you can use the 2-sample
>> version, changing the statistical function (`stat_fun`) being called to one
>> of your own (by default it uses `f_oneway`):
>>
>>
>> https://github.com/mne-tools/mne-python/blob/master/mne/stats/cluster_level.py#L1267
>>
>> Sorry this function isn't in the documentation -- it should be! I fixed
>> it in master, so the function should show up in the developmental version
>> of the documentation in the next couple days:
>>
>> http://martinos.org/mne/dev/python_reference.html#statistics
>>
>> In the meantime you can see the example using it in the docs:
>>
>>
>> http://martinos.org/mne/stable/auto_examples/stats/plot_cluster_stats_spatio_temporal_2samp.html#example-stats-plot-cluster-stats-spatio-temporal-2samp-py
>>
>> If this function won't work for your use case, open an issue on GitHub
>> and we can talk about how to expand or modify the API (and hopefully add an
>> example along the way).
>>
>> Cheers,
>> Eric
>>
>>
>>
>> On Wed, Jan 8, 2014 at 11:23 AM, Matt Erhart <merhart at ucsd.edu> wrote:
>>
>>> Is there a way currently to do the 1samp test without assuming equal
>>> variance?
>>>
>>>
>>> On Wed, Jan 8, 2014 at 12:27 AM, Alexandre Gramfort <
>>> alexandre.gramfort at telecom-paristech.fr> wrote:
>>>
>>>> > In the example online, plot_cluster_stats_spatio_temporal.py, X is
>>>> passed in
>>>> > to ttest 0 and 1 in the forth dimension: X = X[:, :, :, 0] - X[:, :,
>>>> :, 1] #
>>>> > make paired contrast.
>>>> > That subtraction seems strange to me since it seems to lose the
>>>> variance
>>>> > unique to each condition. I would have expected something more like
>>>> > ...1samp_test(X[:, :, :, 0], X[:, :, :, 1]). What am I missing here?
>>>>
>>>> you're right. We assume here equal variance and then the paired t test
>>>> is just a one sample test on the difference.
>>>>
>>>> suggestions of improvement are really welcome.
>>>>
>>>> > Also, my ultimate goal is 1samp and 2samp spatio-temporal clustering
>>>> with
>>>> > TFCE with MEG. ANOVA for groupxcondition would be great as well. In
>>>> > spatio_temporal_cluster_1samp_test, the doc says TFCE will be used if
>>>> a dict
>>>> > is passed in for threshold=, but what is that dict suppose to look
>>>> like?
>>>>
>>>> have a look at the TFCE example
>>>>
>>>>
>>>> http://martinos.org/mne/stable/auto_examples/stats/plot_cluster_methods_tutorial.html
>>>>
>>>> and especially the variable:
>>>>
>>>> threshold_tfce
>>>>
>>>> > Much thanks for the excellent package,
>>>>
>>>> thanks
>>>>
>>>> > P.S. Anaconda was really important for getting this working in centos5
>>>> > without root access. Spyder is working as well which is great for
>>>> > transitioning from matlab.
>>>>
>>>> that's indeed what we recommend to install to get started
>>>>
>>>> Best,
>>>> Alex
>>>>
>>>
>>>
>>> _______________________________________________
>>> 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/20140108/dfa70966/attachment.html 


More information about the Mne_analysis mailing list