<div dir="ltr"><div><p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">Dear FieldTrip Community,</span></p>

<p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif"> </span></p>

<p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">We would like to test differences in coherence at the
single-subject level (i.e., with trial as unit-of-observation) with
cluster-based permutation test. To do this, we thought we could use the
function </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">ft_freqstatistics</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif"> combined with </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">statfun_indepsamplesZcoh</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">. However, when running the code, we get an error, which is probably due to
the fact that </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">statfun_indepsamplesZcoh</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif"> works on channels combinations.
It is therefore non-obvious how to form clusters in the spatial dimension. </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">Since we are interested in computing coherence between
just one channel <i>j</i> and all the other channels <i>N-j</i>,
we would like to form clusters in the spatial dimension across the <i>N-j</i> channels
(plus the frequency and time dimensions). Has anyone in this community ever
dealt with this kind of issue before? And, if so, how did you manage to solve
the problem?</span></p>

<p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">Here is a more detailed description of how the input
data looks like (</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">data1</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif"> and </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">data2</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">, one for each
condition):</span></p></div><div><img src="cid:ii_md8tig3a0" alt="structure.png" width="294" height="186" style="margin-right: 0px;"></div><div><span lang="EN-US" style="text-align:justify;font-size:10pt;line-height:115%;font-family:Arial,sans-serif">Both </span><span lang="EN-US" style="text-align:justify;font-size:10pt;line-height:115%;font-family:Consolas">data1</span><span lang="EN-US" style="text-align:justify;font-size:10pt;line-height:115%;font-family:Arial,sans-serif"> and </span><span lang="EN-US" style="text-align:justify;font-size:10pt;line-height:115%;font-family:Consolas">data2</span><span lang="EN-US" style="text-align:justify;font-size:10pt;line-height:115%;font-family:Arial,sans-serif"> structures are the output of </span><span lang="EN-US" style="text-align:justify;font-size:10pt;line-height:115%;font-family:Consolas">ft_freqanalysis</span><span lang="EN-US" style="text-align:justify;font-size:10pt;line-height:115%;font-family:Arial,sans-serif">.</span><br></div>

<p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">What follows is the code we used:</span></p><p class="MsoNormal" style="margin:12pt 0cm 0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg                  = [];</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.method           = <span style="color:rgb(167,9,245)">'montecarlo'</span>;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.parameter        = <span style="color:rgb(167,9,245)">'fourierspctrm'</span>;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.statistic        = <span style="color:rgb(167,9,245)">'indepsamplesZcoh'</span>;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.correctm         = <span style="color:rgb(167,9,245)">'cluster'</span>;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.clusteralpha     = 0.05;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.clusterstatistic
= <span style="color:rgb(167,9,245)">'maxsum'</span>;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.minnbchan        = 2;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.neighbours       = neighbours;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.tail             = 0;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.clustertail      = 0;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.alpha            = 0.025;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.numrandomization
= 100;</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">n_M1_categ1          = size(data1.fourierspctrm, 1);</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">n_M1_categ2          = size(data2.fourierspctrm, 1);</span></p><p class="MsoNormal" style="margin:0cm;line-height:normal;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.design           = [ones(1,n_M1_categ1),
ones(1,n_M1_categ2)*2]'; </span></p><p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">cfg.ivar             = 1;</span></p><p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">

































</span></p><p class="MsoNormal" style="margin:12pt 0cm 8pt;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">[stat] =
ft_freqstatistics(cfg, data1, data2)</span><span lang="EN-US" style="font-size:10pt;line-height:115%">;</span></p><div><p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">It may be helpful to report also that, when running
the same code without performing cluster-based correction (i.e., </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">cfg.correctm = <span style="color:rgb(167,9,245)">'no'</span></span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">), the </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">stat</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif"> output that we obtain is
a row vector with length equal to the number of channels pairs (</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">reported in </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">stat.cfg.chancmbindx</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">) multiplied by the frequency dimension and the time dimension. This output
shape does not correspond to the </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">dimord</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif"> field reported in the </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">stat</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif"> structure (i.e., </span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">'</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">chancmb_freq_time</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Consolas">'</span><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">).</span></p><p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">Thank you very much for your attention.</span></p><p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">Best,</span></p><p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif"><br></span></p><p class="MsoNormal" style="margin:12pt 0cm 8pt;text-align:justify;line-height:115%;font-size:12pt;font-family:Aptos,sans-serif"><span lang="EN-US" style="font-size:10pt;line-height:115%;font-family:Arial,sans-serif">Francesco Torricelli</span></p></div><div><br></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="text-align:right"><span style="font-size:large">Francesco Torricelli, MSc, PhD</span><br></div><div style="text-align:right"><i>Section of Physiology,</i><br></div><div style="text-align:right"><i>Department of Neuroscience and Rehabilitation,</i></div><div style="text-align:right"><i>University of Ferrara</i></div><div style="text-align:right"><font size="1">Via Fossato di Mortara 19, </font><span style="font-size:x-small">44121 Ferrara (Italy)</span></div><div style="text-align:right"><span style="font-size:x-small">Tel: +39 347 980 9976</span></div></div></div></div>