[FieldTrip] ft_freqstatistics wrong permutation dimension (?)

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Thu Oct 8 11:49:27 CEST 2020


Dear Tim, 

In order to be able to do (permutation-based) statistics, fieldtrip expects single trial (or single subject) data. I guess that the ‘bookkeeping code’ does not like your creative approach to the permutation scheme.
I leave it up to you to decide whether it is valid to begin with to use the channel dimension as the dimension across which you’d want to permute, but I would think that you can fool ft_freqstatistics if you cosmetically change the data objects that go into the function:

siz = size(data.powspctrm);
data.powspctrm = reshape(data.powspctrm,[siz(1) 1 siz(2:3)]); % this squeezes in a singleton ‘chan’ dimension
data.dimord = ‘rpt_chan_freq_time’;
data.label = {‘dummy channel’};

If you do this for both conditions’ data structures, I think the code should run through fine. But again, whether this is OK, I don’t know.

Best wishes,
Jan-Mathijs




> On 7 Oct 2020, at 17:44, Tim Guth <Guth at mailbox.org> wrote:
> 
> Dear community,
> 
> 
> my name is Tim Guth and I am working at the University Clinic Freiburg on intracranial EEG data. I am relatively new to fieldtrip and have a question about the function ft_freqstatistics.
> 
> I tried using it to do a cluster-based permutation test over time-frequency powerspectrum data to compare successfull and non-successfull memory encoding intervals of equal length.
> 
> I obtained the following two data structures by applying ft_freqanalysis on EEG data from 943 separate channels, averaging the powerspectrum results over trials and then concatenating them in a for loop.
> 
> allChanSuccEnc =
> 
>   struct with fields:
> 
>     powspctrm: [943×50×751 double]
>         label: {943×1 cell}
>        dimord: 'chan_freq_time'
>          time: [1×751 double]
>          freq: [1×50 double]
> 
> allChanFailEnc =
> 
>   struct with fields:
> 
>     powspctrm: [943×50×751 double]
>         label: {943×1 cell}
>        dimord: 'chan_freq_time'
>          time: [1×751 double]
>          freq: [1×50 double]
> 
> I then executed ft_freqstatistics(cfg, allChanSuccEnc, allChanFailEnc) with the following configurations:
> 
> cfg                            = [];
> cfg.method             = 'montecarlo';
> cfg.statistic             = 'indepsamplesT'; % use paired ttest
> cfg.correctm           = 'cluster';
> cfg.clusteralpha     = 0.05;
> cfg.clusterstatistic = 'maxsum';
> cfg.neighbours       = [];
> cfg.tail                     = 0;
> cfg.clustertail        = 0;
> cfg.alpha                = 0.025;
> cfg.numrandomization = 500;
> cfg.latency             = [0, 1.5]; % clusters during encoding period
> cfg.neighbours      = [];
> cfg.design               = [ones(1, size(allChanSuccEnc.powspctrm, 1)), ones(1, size(allChanFailEnc.powspctrm, 1)) * 2];
> cfg.ivar                    = 1;
> 
> Unfortunately I get the following error message:
> 
> Error using ft_freqstatistics (line 180)
> the length of the design matrix (1) does not match the number of observations in the data (2)
> 
> It seems like the function does not expect input with only one average trial where the permutation has to be done over channels. Do you have any idea how I can perform the permutation test with the channels (and not the trials) being permutet?
> 
> Thank you for your help
> 
> Tim
> 
> _______________________________________________
> 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