<div dir="ltr"><br>Dear Dr.Maris/ <span style="color:rgb(33,37,41);font-family:-apple-system,"system-ui","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";text-align:justify">Schoffelen /</span><span style="color:rgb(33,37,41);font-family:-apple-system,"system-ui","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";text-align:justify">Oostenveld</span><div><br></div><div>I posted a question on the mailing list about 2x2 ANOVA at the source level (please see below my email).</div><div>It's been 2 weeks and I have not found if there is anything wrong with my code. I would really really appreciate it if you could have a look at my code and let me know if I have done all the steps correctly.</div><div><br></div><div>Thanks a lot,</div><div>Philip</div><div><br></div><div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <strong class="gmail_sendername" dir="auto">philip Joadavi</strong> <span dir="auto"><<a href="mailto:p.joadavi@gmail.com">p.joadavi@gmail.com</a>></span><br>Date: Wed, Mar 15, 2023 at 5:14 PM<br>Subject: 2x2 ANOVA at source level using cluster based permutation<br>To: FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>><br></div><br><br><div dir="ltr">Dear all,<div><br></div><div>I would like to run ANOVA to test the main and interaction effects on my beamforming results. (I used DISC beamformer)</div><div>I've already looked at the FAQ on the FieldTrip website and also the questions in the mailing list.</div><div><br></div><div>To check if I have done the steps correctly, I have also done the 2x2 ANOVA using SPM and I got significant results, but without FWE/FDR correction for multiple comparisons at the voxel level.</div><div><br></div><div>When I apply the steps described in the FieldTrip and also the mailing list (for cluster-based permutation) I could not get any significant clusters. This is surprising for me because I get always nicer results from permutation tests than I do not get from SPM.</div><div><br></div><div>I think I'm doing something wrong and I would appreciate any help.</div><div><br></div><div>So, as far as I understood, I can not use F statistics for 2x2 ANOVA, and therefore I used dependent sample T statistics for within-subject design as explained by Eric in the mailing list. </div><div><br></div><div>here is my code :</div><div>So, I have 2 conditions A and B, each with 2 levels (I & II).</div><div>For the averages, I used ft_ grandaverage for 2 conditions/levels, and I got a matrix of pow = [number of subjects x number of voxels] = [12x 411477]</div><div><br></div><div>Here is the code:</div><div><br></div><div>my data is arranged such that the columns are the conditions (A/B) and the rows are the levels (I/II).</div><div>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;min-height:12px"><span> </span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">% Main effect of levels (I/II)</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">I = ft_sourcegrandaverage([],GA{1,1:2});</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">II = ft_sourcegrandaverage([],GA{2,1:2});</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;min-height:12px"><span> </span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">% Main effect of conditions (A/B)</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">A = ft_sourcegrandaverage([],GA{1:2,1});</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">B = ft_sourcegrandaverage([],GA{1:2,2});</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;min-height:12px"><span> </span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">% Interaction effect</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg <span> </span>= [];</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.operation = <span style="color:rgb(160,32,240)">'subtract'</span>;</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.parameter = <span style="color:rgb(160,32,240)">'pow'</span>;<span> </span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;min-height:12px"><span> </span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">INA = ft_math(cfg, GA{1,1}, GA{2,1}); <span style="color:rgb(34,139,34)">% I - II (A)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">INB = ft_math(cfg, GA{1,2}, GA{2,2}); <span style="color:rgb(34,139,34)">% I - II (B)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34);min-height:12px"><span> </span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34);min-height:12px"><span> </span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)">%% prepare the hypothesis testing</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg<span> </span>= [];</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.dim<span> </span>= GA{1}.dim;</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.method <span> </span>= <span style="color:rgb(160,32,240)">'montecarlo'</span>;</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.correctm <span> </span>= <span style="color:rgb(160,32,240)">'cluster'</span>;</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.spmversion <span> </span>= <span style="color:rgb(160,32,240)">'spm12'</span>;</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.parameter<span> </span>= <span style="color:rgb(160,32,240)">'pow'</span>;</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)"><span style="color:rgb(0,0,0)">cfg.numrandomization = </span><span style="color:rgb(160,32,240)">'all'</span><span style="color:rgb(0,0,0)">; </span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.correcttail<span> </span>= <span style="color:rgb(160,32,240)">'alpha'</span>;</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;min-height:12px"><br></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)"><span style="color:rgb(0,0,0)">cfg.statistic<span> </span>= </span><span style="color:rgb(160,32,240)">'depsamplesT'</span><span style="color:rgb(0,0,0)">;</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.alpha<span> </span>= 0.05/2; <span style="color:rgb(34,139,34)">% two tails</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.clusteralpha <span> </span>= 0.01;</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(34,139,34)"><span style="color:rgb(0,0,0)">cfg.tail <span> </span>= 0; </span>% I also tried 1 for one tail</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.clustertail<span> </span>= <span style="color:rgb(0,0,0)">cfg.tail</span>;</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.uvar <span> </span>= 1; <span style="color:rgb(34,139,34)">% subject</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.ivar <span> </span>= 2; <span style="color:rgb(34,139,34)">% conditions</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">cfg.design <span> </span>= [repmat(1:numel(subjects),1,2); repelem([1 2],numel(subjects))];</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;min-height:12px"><span> </span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;color:rgb(160,32,240)"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">stat{1} <span> </span>= ft_sourcestatistics(cfg,I,II); <span style="color:rgb(34,139,34)">% main effect (I/II)</span><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier">stat{2} <span> </span>= ft_sourcestatistics(cfg,A,B); <span style="color:rgb(34,139,34)">% main effect (A/B)</span><br></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier;min-height:12px"><span>stat{3} <span> </span>= ft_sourcestatistics(cfg,INA,INB); </span><span style="color:rgb(34,139,34)">% Interaction</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:10px;line-height:normal;font-family:Courier"><br></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small">Side note: I also tried the one-tail option, but the results were not significant eighter. </span><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;font-family:Courier;min-height:14px"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small"><br></span></p></div><div><br></div><div>I would appreciate any help!</div><div>Best,</div><div>Philip</div><div><br></div><div> </div></div>
</div></div></div>