<div dir="ltr"><div>Thank you very much Philipp and Tzvetan!</div><div><br></div><div>Things have become much clearer now. </div><div><br></div><div>I would like to follow up with a very related question. I am trying to replicate the analysis for the cluster based permutation test using the code and the data provided. However, i run into two problems here</div><div><br></div><div>First, i get the following error if i use the original code: </div><div><div>Attempted to access cfg.frequency(2); index out of bounds because</div><div>numel(cfg.frequency)=1.</div><div><br></div><div>Error in ft_freqstatistics (line 187)</div><div>cfg.frequency = [max(cfg.frequency(1), fmin), min(cfg.frequency(2), fmax)];</div></div><div><br></div><div>Therefore , i change the input cfg.frequency=20 to cfg.frequency=[20 20]. However, then no significant clusters are found. Which becomes clear when trying to plot the cluster or by looking at the output of ft_freqstatistics. </div><div><br></div><div>Does the change in the code , change the output? How can i avoid the error mentioned above and still get the same output from ft_freqstatistics as the one provided on the webpage? </div><div><br></div><div><div><br></div><div>The relevant section of the toturial is provided below.</div><div>Thank you!</div><div><br></div><div>Victoria</div><div><br></div></div><div><h3 class="" style="padding:0px;margin:0.9em 0px 0em;clear:left;color:rgba(0,0,0,0.65098);font-size:1.2em;line-height:1.8em;font-family:Calibri,Geneva,Arial,Verdana,sans-serif;text-align:justify"><a name="permutation_test" id="permutation_test" title="" style="padding:0px;margin:0px">Permutation test</a></h3><div class="" style="padding:0px;margin:0px;color:rgb(0,0,0);font-family:Calibri,Geneva,Arial,Verdana,sans-serif;font-size:15px;line-height:22.5px;text-align:justify"><p style="padding:0px;margin:0px 0px 1em;font-size:1em;line-height:1.5em">Now, run <strong style="padding:0px;margin:0px"><a href="http://www.fieldtriptoolbox.org/reference/ft_freqstatistics" class="" title="" style="padding:0px;margin:0px;color:rgb(0,136,204);text-decoration:none">ft_freqstatistics</a></strong> to compare freqFIC_planar_cmb and freqFC_planar_cmb. Except for the field cfg.latency, the following configuration is identical to the configuration that was used for comparing event-related averages in the <a href="http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock" class="" title="" style="padding:0px;margin:0px;color:rgb(0,136,204);text-decoration:none">cluster-based permutation tests on event related fields tutorial</a>. Also see <a href="http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock" class="" title="" style="padding:0px;margin:0px;color:rgb(0,136,204);text-decoration:none">this tutorial</a> for a detailed explanation of all the configuration settings. You can read more about the <strong style="padding:0px;margin:0px"><a href="http://www.fieldtriptoolbox.org/reference/ft_prepare_neighbours" class="" title="" style="padding:0px;margin:0px;color:rgb(0,136,204);text-decoration:none">ft_prepare_neighbours</a></strong> function in the <a href="http://www.fieldtriptoolbox.org/faq/how_does_ft_prepare_neighbours_work" class="" title="" style="padding:0px;margin:0px;color:rgb(0,136,204);text-decoration:none">FAQ's</a>.</p><p style="padding:0px;margin:0px 0px 1em;font-size:1em;line-height:1.5em">To load the planar gradient TFRs (also available on the FieldTrip <acronym title="File Transfer Protocol" style="padding:0px;margin:0px;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(51,51,51)">FTP</acronym> servers,<a href="ftp://ftp.fieldtriptoolbox.org/pub/fieldtrip/tutorial/cluster_permutation_freq/freqFIC_planar_cmb.mat" class="" title="" rel="nofollow" style="padding:1px 0px 1px 16px;margin:0px;color:purple;text-decoration:none;background:url("/lib/tpl/FieldTripV2/images/link_icon.gif") 0px 1px no-repeat transparent">freqFIC_planar_cmb.mat</a> and <a href="ftp://ftp.fieldtriptoolbox.org/pub/fieldtrip/tutorial/cluster_permutation_freq/freqFC_planar_cmb.mat" class="" title="" rel="nofollow" style="padding:1px 0px 1px 16px;margin:0px;color:purple;text-decoration:none;background:url("/lib/tpl/FieldTripV2/images/link_icon.gif") 0px 1px no-repeat transparent">freqFC_planar_cmb.mat</a>), use:</p><pre class="" style="padding:0.5em;margin-top:0px;margin-bottom:1em;font-size:12px;border:1px dashed rgb(204,204,204);overflow:hidden;font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;white-space:pre-wrap;width:640px;background-color:rgb(247,249,250)">load freqFIC_planar_cmb
load freqFC_planar_cmb

cfg = [];
cfg.channel          = {'MEG', '-MLP31', '-MLO12'};
cfg.latency          = 'all';
cfg.frequency        = 20;
cfg.method           = 'montecarlo';
cfg.statistic        = 'ft_statfun_indepsamplesT';
cfg.correctm         = 'cluster';
cfg.clusteralpha     = 0.05;
cfg.clusterstatistic = 'maxsum';
cfg.minnbchan        = 2;
cfg.tail             = 0;
cfg.clustertail      = 0;
cfg.alpha            = 0.025;
cfg.numrandomization = 500;
% prepare_neighbours determines what sensors may form clusters
cfg_neighb.method    = 'distance';
cfg.neighbours       = ft_prepare_neighbours(cfg_neighb, dataFC);

design = zeros(1,size(freqFIC_planar_cmb.powspctrm,1) + size(freqFC_planar_cmb.powspctrm,1));
design(1,1:size(freqFIC_planar_cmb.powspctrm,1)) = 1;
design(1,(size(freqFIC_planar_cmb.powspctrm,1)+1):(size(freqFIC_planar_cmb.powspctrm,1)+...
  size(freqFC_planar_cmb.powspctrm,1))) = 2;

cfg.design           = design;
cfg.ivar             = 1;

[stat] = ft_freqstatistics(cfg, freqFIC_planar_cmb, freqFC_planar_cmb);</pre></div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-18 17:57 GMT+00:00 Tzvetan Popov <span dir="ltr"><<a href="mailto:tzvetan.popov@uni-konstanz.de" target="_blank">tzvetan.popov@uni-konstanz.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div>
<div><div style="word-wrap:break-word"><div>Hi Victoria,</div><div><br></div><div>oopsy, I think I confused you dramatically. I’m sorry for this. You are right I was only scrolling up to the part where the mags were analyzed. As for combining the MEG*2 and MEG*3 I was wrong there too. Of course you can threat them separately, as I was naively thinking as non-neuormag user, but indeed combination of both is recommended as I have now learned :-)(thanks Phillip). I ran the following steps and I guess this should work for you.</div><div>best </div><div>tzvetan</div><div><br></div><div><div style="margin:0px;font-size:8px;font-family:Courier;color:rgb(37,153,45)">%%</div><div style="margin:0px;font-size:8px;font-family:Courier">cfg = [];</div><div style="margin:0px;font-size:8px;font-family:Courier">ComCon = ft_combineplanar(cfg,FreqCon);</div><div style="margin:0px;font-size:8px;font-family:Courier;color:rgb(37,153,45)">%%</div><div style="margin:0px;font-size:8px;font-family:Courier">cfg = []</div><span class=""><div style="margin:0px;font-size:8px;font-family:Courier;color:rgb(178,69,243)"><span style="color:#000000">cfg.method = </span>'triangulation'<span style="color:#000000">;</span></div><div style="margin:0px;font-size:8px;font-family:Courier">cfg.layout           = <span style="color:#b245f3">'neuromag306cmb.lay'</span>;</div></span><div style="margin:0px;font-size:8px;font-family:Courier">cfg.senstype         = <span style="color:#b245f3">'MEG'</span>;</div><div style="margin:0px;font-size:8px;font-family:Courier">neighbours = ft_prepare_neighbours(cfg, ComCon)</div><div style="margin:0px;font-size:8px;font-family:Courier;color:rgb(37,153,45)">%%</div><div style="margin:0px;font-size:8px;font-family:Courier;color:rgb(37,153,45)">% plot neighbours</div><div style="margin:0px;font-size:8px;font-family:Courier">cfg=[];</div><div style="margin:0px;font-size:8px;font-family:Courier">cfg.neighbours = neighbours;</div><div style="margin:0px;font-size:8px;font-family:Courier">cfg.layout           = <span style="color:#b245f3">'neuromag306cmb.lay'</span>;</div><div style="margin:0px;font-size:8px;font-family:Courier">ft_neighbourplot(cfg);</div></div><div><br></div><div><br></div></div></div></div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>