[FieldTrip] Cluster-based permutation tests for between-subject design

Eric Maris e.maris at psych.ru.nl
Fri Oct 31 16:56:16 CET 2014

Dear Dylan,

I replied to your question on the Fieldtrip faq page that you refer to. 
Although the problem can be solved, it is not implemented yet, because it 
requires the implementation of three new statfuns: Hotelling’s T-square for 
dependent samples, Hotelling’s T-square for independent samples, and Wilk’s 
lambda. A good statistics book (e.g., Johnson & Wichern) will show you how 
to do this yourself. Otherwise, you have to be patient.

Although your statistical problem can be solved, with neurobiological data, 
it is almost never wise to statistically test interaction effects in designs 
more complicated than the 2-by-2 factorial design. In these more complicated 
designs, you always end up with F-tests, which do not inform you about the 
pattern in the data that is responsible for the interaction effect.



From: Dylan DeLosAngeles [mailto:dylan.delosangeles at gmail.com]
Sent: dinsdag 28 oktober 2014 13:22
To: FieldTrip discussion list
Subject: Re: [FieldTrip] Cluster-based permutation tests for between-subject 

Thank you, Eelke.
I'm sorry I am not picking this up more quickly.

Your examples of passing either multiple structs or cell arrays to 
ft_freqstatistics deals with one group of subjects in multiple conditions, 
or two groups in one condition, respectively. I have two groups, both doing 
multiple (11) conditions and I would like to know how to handle that in 
ft_freqstatistics. What I require seems to be similar to what Eric Maris 
wrote about here:

 <http://fieldtrip.fcdonders.nl/faq/how_can_i_test_an_interaction_effect_using_cluster-based_permutation_tests>http://fieldtrip.fcdonders.nl/faq/how_can_i_test_an_interaction_effect_using_cluster-based_permutation_testsbut instead of a 2-by-2 factorial design, I am using a 2-by-11 factorialdesign. As such, I am not sure how this translates when making differencedata structures. I hope I am not missing something obvious.Thanks again,DylanOn Tuesday, 28 October 2014, Eelke Spaak <eelke.spaak at donders.ru.nl> wrote:Dear Dylan,You don't want (or need) a single struct with a subj X chan X freq Xtime powspctrm. Instead, it is often convenient to collect eachindividual subject's struct in a *cell* array (rather than a structarray). See, for example, here:http://www.mathworks.nl/help/matlab/cell-arrays.html and here:http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/.At the statistics step you should pass in multiple structs, each onecorresponding to one unit-of-observa
 tion, to ft_freqstatistics. Thiscan be done like so:stat = ft_freqstatistics(cfg, struct11, struct12,struct13,...struct21, struct22, ...);or, using the cell arrays, like so:stat = ft_freqstatistics(cfg, groupA{:}, groupB{:});Make sure that each column in your design matrix describes oneunit-of-observation, in the order in which the structs are passed intoft_freqstatistics.Best,EelkeOn 21 October 2014 03:41, Dylan DeLosAngeles<dylan.delosangeles at gmail.com <javascript:;> > wrote:> Dear Eelke,>> Thank you for help regarding cluster-based permutation analysis of two ormore conditions.>> I am using time-frequency data (not time-lock structures). My firstproblem seems to be getting my 12 subjects into the 4D powspectrum.>> My code below loads 12 subjects from the first group, but I end up with a1 x 12 struct where each struct's .powspctrm is 1 subject x 11 electrodes x3 frequencies x 2049 time points, rather than one struct with a 4D powspctrmwith 12 subjects as rows x electrodes x freqs 
 x time points.>> for k = 1:Nmt, % states>     for i = 1%:Ng, % groups>         for j = 1:Ns, % subjects>>             % load files>             p(j) = eeg3.eeg.load(fullfile(fpath,fname2));>>             % convert to eeglab to get channel locations>             EEG(j) = eeg2eeglab( p(j));>             EEG(j) = pop_chanedit( EEG(j), 'lookup', chanlocfile);>>             % preprocessing in fieldtrip>             d(j) = eeglab2fieldtrip( EEG(j), 'preprocessing');>>             % specify length of time to use in config>             time = EEG(j).xmax-EEG(j).xmin;>>             % setup configuration for freqanalysis>             cfg = [];      % clear cfg>             cfg.output     = 'pow';>             cfg.channel    = 'EEG';>             cfg.method     = 'mtmconvol';>             cfg.taper      = 'hanning';>             cfg.foi        = 0.5:3; % delta>             cfg.toi        = 1:0.05:time; % length of each state>             cfg.t_ftimwin  = 7./cfg.foi; % 7 cycles>             cfg
 .keeptrials = 'yes';>>             % do freqanalysis>             freqdata(j) = ft_freqanalysis( cfg, d(j));>         end>     end> end>> My second problem is loading in the second group of 12 subjects and whatthat will look like when I run ft_freqstatistics.>> Lastly, I just want to confirm what you said in your previous email, thatI should be using indepsamplesF for more than two conditions (I have 11),and therefore my design should look like this;> 1     2     1     2     1     2     1     2     1     2     1     2     12      1     2     1     2     1     2      1      2     (two groups)> 1     1     2     2     3     3     4     4     5     5     6     6     77      8     8     9     9    10    10    11    11     (11 conditions)>> Any help would be appreciated.>> Kind regards,> Dylan>>>>> On Wed, Sep 24, 2014 at 3:29 PM, Eelke Spaak <eelke.spaak at donders.ru.nl<javascript:;> <mailto:eelke.spaak at donders.ru.nl <javascript:;> >> wrote:> Hello Dylan,>> You can analyse a between-subje
 cts design exactly as you would a> between-trials design (at least as far as the statistics step is> concerned), in both cases the two conditions correspond to two groups> of observations, and not to the same group of observations measured in> two separate conditions (which would be a within-UO design). In> FieldTrip, you would typically compute averages per subject, then use> an "indepsamplesT" (or indepsamplesF with >2 conditions) statistic> (not depsamples). indepsamplesT only requires one row in the design> matrix, indicating the condition.>> Note that if you have e.g. timelock structures in two (or more) cell> arrays, corresponding to the conditions, you can input them into the> statistics function as follows:>> stat = ft_timelockstatistics(cfg, tlCondA{:}, tlCondB{:});>> without having to call ft_timelockgrandaverage. In fact, the above is> the preferred way to do statistics now. (The same holds for> ft_freqstatistics.)>> Hope that helps,> Best,> Eelke>> On 24 September 2014 0
 2:32, Dylan DeLosAngeles> <dylan.delosangeles at gmail.com <javascript:;><mailto:dylan.delosangeles at gmail.com <javascript:;> >> wrote:>> Hello,>>>> So far, the tutorial on "Cluster-based permutation tests ontime-frequency>> data" has been very helpful.>>>> Out of the four combinations from the two UO-types (subjects and trials)and>> the two experimental designs (between- and within-UO), the tutorialcovers>> statistics on data in two conditions in a between-trials, in awithin-trials>> and in a within-subjects design. However, I am wondering if there is any>> information about the fourth type of experiment design: between-subjects.>>>> I have data for 2 groups with 12 subjects in each group. Both groups are>> measured during 11 conditions.>> Can I approach this in a similar fashion to within-subjects design(multiple>> subjects in multiple experimental conditions), such that my design is>> multiple groups in multiple experimental conditions. Is it a case offirst>> averaging over all trial
 s belonging to each of the experimentalconditions>> for each subject (as instructed in tutorial), and then averaging over all>> subjects in each group?>>>> Configuration code for setting up the design currently looks like this;>> grp = 2;>> subj = 11;>> design = zeros(2, subj*grp);>>>> for i = 1:grp>>     design(1,i:2:end) = i;>> end>>>> idx = 1;>> for i = 1:subj>>     design(2,idx:idx+1) = i;>>     idx = idx+2;>> end>>>> Is there anything else I need to take into consideration when doing these>> statistics?>>>> Thank you,>> Dr Dylan DeLosAngeles>> Research Fellow>> Brain Signal Laboratory>> Flinders University>>>> _______________________________________________>> fieldtrip mailing list>> fieldtrip at donders.ru.nl <javascript:;> <mailto:fieldtrip at donders.ru.nl<javascript:;> >>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip> _______________________________________________> fieldtrip mailing list> fieldtrip at donders.ru.nl <javascript:;> <mailto:fieldtrip at donders.ru.nl<javascrip
 t:;> >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip>_______________________________________________fieldtrip mailing listfieldtrip at donders.ru.nl <javascript:;>http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141031/b2f1dcc5/attachment-0002.html>

More information about the fieldtrip mailing list