[FieldTrip] Error: Could not determine the parametric critical value for clustering

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Wed Jan 30 15:34:14 CET 2019

Dear Paul,


Thanks. Although I still can’t see how you got to the data that goes into your ft_freqstatistics (the variable names don’t match up), something is probably wrong with your first level-statistics. 

-          Have you tried running your stats first without cluster corrections, i.e. cfg.method = ‘analytic’? I would do so (always) and first check the results. I suspect you’ll find something like only NaNs due to perhaps some wrong latencies, design, etc.  Around line 244 ft_statistics_montecarlo tries to threshold your first-level statistics. You could also add a breakpoint there and see why it fails, but first running your first-level statistics might already clarify.

-          Just in case - make sure you empty your cfg before you set your parameters for ft_freqstatistics J






From: fieldtrip <fieldtrip-bounces at science.ru.nl> On Behalf Of Paul Dhami
Sent: Wednesday, January 30, 2019 2:56 PM
To: fieldtrip at science.ru.nl
Subject: Re: [FieldTrip] Error: Could not determine the parametric critical value for clustering


Dear Stephen,


apologizes for not including that information. 


The data structure (e.g. ControlsSubj_sp_lpfc_freq) was created using:


  % frequency analysis

  cfg                 = []; 

  cfg.output          = 'powandcsd';

  cfg.method          = 'mtmconvol';

  cfg.foi             = 2:1:60; %40

  cfg.t_ftimwin       =  2 ./ cfg.foi; %length of the sliding time window in seconds

  cfg.tapsmofrq       = 0.4 *cfg.foi; % smoothing increases with increase in freq

  cfg.toi             = -1:0.01:1; % -0.4:0.01:0.4


  dataSPfreq = ft_freqanalysis(cfg, dataSPfreq); 


  %baseline correction

  cfg = []; 

  cfg.baseline = [-1 -0.1]; %-0.4 

  cfg.baselinetype = 'db'; 

  dataSPfreq = ft_freqbaseline(cfg, dataSPfreq);


The call to freqstatistics is as follows:

cfg = [];


cfg.method      = 'template';        % using template method

cfg.template    = 'Control_neighb.mat'; % specify type of template 

cfg.layout      = 'quickcap64.mat';  % specify layout of sensors

cfg.feedback    = 'yes';             % show a neighbour plot 



neighbours      = ft_prepare_neighbours(cfg, MDDSubj_sp_lpfc_freq{1}); 



cfg.channel = 'all';

cfg.latency = [0.01 1] ;

cfg.frequency = 'all' ;

cfg.parameter = 'powspctrm';


cfg.neighbours          = neighbours; % defined as above

cfg.method              = 'montecarlo';

cfg.statistic           = 'ft_statfun_indepsamplesT';



cfg.correcttail         = 'alpha'; 

cfg.correctm            = 'cluster';

%cfg.alpha = 0.05

cfg.numrandomization    = 2000;

cfg.minnbchan           = 2;

cfg.spmversion          = 'spm12'; 

cfg.fsample             = 1000;



Nsub                        = length(ControlsSubj_sp_lpfc_freq) + length(MDDSubj_sp_lpfc_freq) ; 

cfg.design                  = [];

cfg.design(1,1:Nsub)        = [ones(1, length(ControlsSubj_sp_lpfc_freq)) (2*ones(1, length(MDDSubj_sp_lpfc_freq)))];

cfg.ivar                    = 1;


% Resulting Cluster Corrected Permutation test

% !!order of structures must follow that specified in the design matrix!!

MDD_vs_Controls_sp_lpfc_freq_mcc = ft_freqstatistics(cfg,ControlsSubj_sp_lpfc_freq{:}, MDDSubj_sp_lpfc_freq{:});


It is after calling ft_freqstatistics that I get the error "Could not determine the parametric critical value for clustering".


Any help would be greatly appreciated.


Thank you,


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

More information about the fieldtrip mailing list