[FieldTrip] single subject coherence statistics

Raghavan Gopalakrishnan gopalar.ccf at gmail.com
Fri Oct 19 19:34:35 CEST 2018


Dear all,

There has been a lot of discussion on the topic of finding statistical
significance between two conditions within the same subject, but there still
seems to be some lack of clarity and issues.


As I understand, The first step is to compute frequencies using
ft_freqanalysis, with keep trials as ‘yes’ and output=’fourier’


cfg            = [];

cfg.output     = 'fourier';

cfg.method     = 'mtmfft';

cfg.foilim     = [5 100];

cfg.tapsmofrq  = 5;

cfg.keeptrials = 'yes';

cfg.trials = find(data_redef.trialinfo(:,1)==trialopt);

freq           = ft_freqanalysis(cfg, data_redef);


freq = 


  struct with fields:


            label: {36×1 cell}

           dimord: 'rpttap_chan_freq'

             freq: [1×191 double]

    fourierspctrm: [1444×36×191 double]

        cumsumcnt: [76×1 double]

        cumtapcnt: [76×1 double]

        trialinfo: [76×5 double]

              cfg: [1×1 struct]


The second step is to compute statistics using cfg.statistic =
‘indepsamplesZcoh’ Below is the example code


cfg1 = [];

cfg1.method = 'montecarlo';       

cfg1.statistic = 'indepsamplesZcoh';                                 

cfg1.correctm = 'cluster';

cfg1.clusteralpha = 0.05;

cfg1.minnbchan = 2;               


cfg1.neighbours = neighbours;   % neighbours computed separately before

cfg1.tail = 0;                    % -1, 1 or 0 (default = 0); one-sided or
two-sided test

cfg1.clustertail = 0;

cfg1.alpha = 0.025;               % alpha level of the permutation test

cfg1.numrandomization = 500;      % number of draws from the permutation


cfg1.parameter = 'fourierspctrm';


design = zeros(1,size(freq1.fourierspctrm,1) + size(freq2.fourierspctrm,1));

design(1,1:size(freq1.fourierspctrm,1)) = 1;

design(1,(size(freq1.fourierspctrm,1)+1):(size(freq1.fourierspctrm,1) +
size(freq2.fourierspctrm,1)))= 2;


cfg1.design = design';

cfg1.ivar  = 1;

cfg1.channelcmb       = {'FC1' 'REMG'}; % coherence between two channels

cfg1.computecritval = 'yes';

stat=ft_freqstatistics(cfg1, freq1, freq2); % freq1 and freq2 are two
conditions from same subject



But the second step gives an error because of dimension issues with the data


Assignment has more non-singleton rhs dimensions than non-singleton


Error in ft_statistics_montecarlo (line 319)

      statrand(:,i) = dum.stat;


Error in ft_freqstatistics (line 193)

    [stat, cfg] = statmethod(cfg, dat, design);


Error in Griptask_RT_coherence_analysis (line 140)

stat=ft_freqstatistics(cfg1, freq1, freq2);


There are couple of previous posts (below) that reported the same kind of
error, but there is no solution yet





In the below post, Jan-Mathijs says not to use ‘cluster’ for correctm
option. However, if we don’t use then how to reproduce the effects reported
in “Nonparametric statistical testing of coherence differences” paper?





Is this error due to a bug? Or am I doing any mistake? I appreciate
developers addressing this issue.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20181019/df0506c3/attachment-0001.html>

More information about the fieldtrip mailing list