[FieldTrip] Question on coherence stats at sensor level

Jörn M. Horschig jorn at artinis.com
Tue Mar 1 17:20:34 CET 2016

Hi David,


The problem is with specifying cfg.statistics = ‘diff’. the ft_xxxstats
function work by ‘eval’-ing the content of cfg.statistics. Thus, it runs
the built-in Matlab function ‘diff’, which is not defined for structs
such as FT-data variables, but only for matrices (and cells?). 

I saw there is also a ft_statfun_diff, which is probably the one you
were aiming to use.  The problem is that internally, the private
function ft_getuserfun is checking first for the existence of ‘diff’,
before it even comes to considering ‘ft_statfun_diff’. Long story short,
you can most likely solve your problem by specifying ‘ft_statfun_diff’
instead of ‘diff’, and the FT guys should think about what to do with


All the best,



Jörn M. Horschig, PhD, Software Engineer
 <http://www.artinis.com/> Artinis Medical Systems  |  +31 481 350 980 


From: fieldtrip-bounces at science.ru.nl
[mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of David Pedrosa
Sent: Tuesday, March 1, 2016 16:22
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] Question on coherence stats at sensor level


Dear list, 

I running analyses on the sensor level with EMG-EEG coherence data and I
ran into some problems. Basically my intention is to compare the
corticomuscular coherence at rest versus during an activation task. For
that, according to some older posts and literature, I computed the
Z-transformed coherence (after using ft_connectivityanalyses, I manually
transformed the cohspctrm data with respect to the dof) which I want to
test with a permutation test. Now, when it comes to computing the stats,
it gives me the error >> Function 'diff' is not supported for class
'struct'. << Would it be more reasonable using another function? Or does
anyone have an idea where my problem could be or what I should do

Here's the used code I use:

                %% for loop normalizing coherence manually and creating
0-coherence data...           
                coh_diff{1,1} =  coh_diff_condition{1,1}.cohspctrm =
(atanh(x1) - ...
                coh_diff_null{1,1}.cohspctrm(:) =  0;

                cfg = [];
                cfg.channel                   = {'EEG' 'xEDC'};
                cfg.parameter               = 'cohspctrm';
                cfg.method                   = 'montecarlo';
                cfg.statistic                   = 'diff';
                cfg.tail                          = 0;
                cfg.clustertail                 = 0;
                cfg.alpha                       = .025;
                cfg.numrandomization    = 500;
                cfgl = [];
                cfgl.layout  = 'brainamp.sfp';
                cfg.layout   = ft_prepare_layout(cfgl);
                cfg.computestat          = 'yes';
                cfg.correctm               = 'cluster';
                cfg.clusteralpha          = .05;
                cfg.clusterstatistic       = 'maxsum';
                cfg.minnbchan            = 2;
                cfgn = [];
                cfgn.method = 'distance';
                cfgn.neighbourdist = 40; %in mm
                cfg.neighbours =
                design = zeros( 2,2*numel(coh_diff));
                design(1,:) = [1:numel(coh_diff),
                design(2,1:numel(coh_diff)) = 1;
design(2,numel(coh_diff)+1:numel(coh_diff)+numel(coh_diff_null)) = 2;
                cfg.design = design;
                cfg.ivar  = 1;
                cfg.uvar = 2;
                [stat] = ft_freqstatistics(cfg, coh_diff{1,1},
coh_diff{1,2}, ..., coh_diff_null{1,12};

Thanks for your help.



Dr. David Pedrosa

Clinical Research Fellow

Medical Research Council Brain Network Dynamics Unit at the University
of Oxford
Nuffield Department of Clinical Neurosciences

University of Oxford

Level 6, West Wing

John Radcliffe Hospital, OX3 9DU

Tel: +44 (0)1865 572490
E-Mail:  <mailto:david.pedrosa at ndcn.ox.ac.uk>
david.pedrosa at ndcn.ox.ac.uk

rcbndu.ox.ac.uk%2f> http://www.mrcbndu.ox.ac.uk/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160301/1de70065/attachment-0002.html>

More information about the fieldtrip mailing list