[FieldTrip] Errors with ft_clusterplot

Eelke Spaak e.spaak at donders.ru.nl
Fri Jun 5 08:51:46 CEST 2020


Dear Marion,

> First, the computation is very long (half an hour for 4 channels..) so I was wondering if it is "normal". Or should the calculation be faster?

This indeed is very long. ft_clusterplot will plot channel
topographies for every time (/frequency) point in the clusters in the
data. From the command window feedback you pasted I see that in your
case, this results in 101 (!) subplots. Given how relatively slow
Matlab plotting is in general, that would explain the slowness here. I
would recommend some other way of plotting the results of the
statistical test, e.g. "manually" using ft_topoplotER, selecting a
time window, and using cfg.highlightchannel or so (based on
stat.mask).

> Second, the function stops after a while, saying the layout is no detected (cf. code below). This seems strange to me as it is able to compute the first 4 subplot, and so the layout was found. Do you have any idea why ?

This is strange, and I have no direct answer here.

> does the alpha parameter needs to correspond to the clusteralpha or to the alpha from the statistics part?

The cfg.alpha from the statistics part. This is the parameter that
determines the false alarm rate of the statistical test.
cfg.clusteralpha is only used to form and group cluster candidates and
is strictly speaking not related to the statistical test (i.e. the
comparison of the observed data to the randomization distribution)
itself.

Best,
Eelke

>
> Thanks a lot,
>
> Marion
>
> --- ERROR ---
>
> reading layout from file biosemi128.lay
> the call to "ft_prepare_layout" took 0 seconds
> There are 2 clusters smaller than alpha (0.05)
> Positive cluster: 1, pvalue: 0.000999 (*), t = 0.30957 to 1
> Negative cluster: 1, pvalue: 0.020979 (x), t = 0 to 0.40039
> making subplots...
> making subplot 1 from 101
> making subplot 2 from 101
> making subplot 3 from 101
> making subplot 4 from 101
> Error using ft_prepare_layout (line 927)
> no layout detected, please specify cfg.layout
>
>
>
> ------- Here's the code : -------
>
> % Set parameters
> avg_time = 'no';
> avg_freq = 'yes';
>
> % prepare the 'design' matrix for the statistical evaluation
> nsubj = length(condA);
> design = [1:nsubj 1:nsubj ; ones(1,nsubj) ones(1,nsubj)*2]; % on compare 2 condtions  donc seulement 2 conditions !
>
> % load neighbours
> load(fullfile(results_path,'neighboursAVPred.mat'))
>
>
> %--- Statisctics parameters with cluster
> cfg                  = [];
> cfg.feedback         = 'yes'
> cfg.neighbours       = neighbours;
> cfg.channels         = {'all'};
> cfg.latency          = 'all';
> cfg.avgovertime       = avg_time;
> cfg.frequency        = 'all';
> cfg.avgoverfreq      = avg_freq;
> cfg.method           = 'montecarlo';
> cfg.clusterthreshold = 'nonparametric_common';
> cfg.correctm         = 'cluster';
> cfg.clusteralpha     = 0.05;
> cfg.clusterstatistic = 'maxsum';
> cfg.minnbchan        = 2;
> cfg.tail             = 0; % 2-sided
> cfg.clustertail      = 0;
> cfg.alpha            = 0.025;
> cfg.numrandomization = 1000;
> cfg.statistic        = 'ft_statfun_depsamplesT';
> cfg.design           = design;
> cfg.uvar             = 1;
> cfg.ivar             = 2;
>
>
> statPw = ft_freqstatistics(cfg, condA{:}, condB{:}); % the 2 conditions to compare, obtained from previous code
>
> % clusterplot
> cfg = [];
> cfg.zlim = [-5 5];
> cfg.alpha = 0.05; % cluster alpha
> cfg.layout = 'biosemi128.lay';
>
> ft_clusterplot(cfg,statPw);
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list