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