[FieldTrip] Questions about using ft_freqstatistics with 'indepsamplesZcoh'

Francesco Torricelli francesco.torricelli at unife.it
Fri Jul 18 15:23:34 CEST 2025


Dear FieldTrip Community,



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 ft_freqstatistics
combined with statfun_indepsamplesZcoh. However, when running the code, we
get an error, which is probably due to the fact that
statfun_indepsamplesZcoh works on channels combinations. It is therefore
non-obvious how to form clusters in the spatial dimension. Since we are
interested in computing coherence between just one channel *j* and all the
other channels *N-j*, we would like to form clusters in the spatial
dimension across the *N-j* 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?

Here is a more detailed description of how the input data looks like (data1
and data2, one for each condition):
[image: structure.png]
Both data1 and data2 structures are the output of ft_freqanalysis.

What follows is the code we used:

cfg                  = [];

cfg.method           = 'montecarlo';

cfg.parameter        = 'fourierspctrm';

cfg.statistic        = 'indepsamplesZcoh';

cfg.correctm         = 'cluster';

cfg.clusteralpha     = 0.05;

cfg.clusterstatistic = 'maxsum';

cfg.minnbchan        = 2;

cfg.neighbours       = neighbours;

cfg.tail             = 0;

cfg.clustertail      = 0;

cfg.alpha            = 0.025;

cfg.numrandomization = 100;

n_M1_categ1          = size(data1.fourierspctrm, 1);

n_M1_categ2          = size(data2.fourierspctrm, 1);

cfg.design           = [ones(1,n_M1_categ1), ones(1,n_M1_categ2)*2]';

cfg.ivar             = 1;

[stat] = ft_freqstatistics(cfg, data1, data2);

It may be helpful to report also that, when running the same code without
performing cluster-based correction (i.e., cfg.correctm = 'no'), the stat
output that we obtain is a row vector with length equal to the number of
channels pairs (reported in stat.cfg.chancmbindx) multiplied by the
frequency dimension and the time dimension. This output shape does not
correspond to the dimord field reported in the stat structure (i.e., '
chancmb_freq_time').

Thank you very much for your attention.

Best,


Francesco Torricelli


-- 
Francesco Torricelli, MSc, PhD
*Section of Physiology,*
*Department of Neuroscience and Rehabilitation,*
*University of Ferrara*
Via Fossato di Mortara 19, 44121 Ferrara (Italy)
Tel: +39 347 980 9976
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20250718/314e85ed/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: structure.png
Type: image/png
Size: 9923 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20250718/314e85ed/attachment.png>


More information about the fieldtrip mailing list