[FieldTrip] Cluster based permutation test for single channel, ft_freqstatistics

Brener, Stephanie Stephanie.Brener at ucsf.edu
Mon Aug 7 20:46:14 CEST 2023


Hi fieldtrippers,

I am trying to perform cluster-based permutation testing on a single channel of DBS electrode data to cluster in time/frequency rather than spatially. I have already pre-processed, cleaned, and separated time-locked events for the data outside of fieldtrip, leaving me with measures of baseline-corrected power in a data array with these dimensions: (50 frequencies x 500 time samples x 180 trials x 3 events).

The dimensions can be described by:

  *   50 Morlet wavelets from 0 to 50Hz --> power at 50 frequencies
  *   500 samples = 1 second before and after time locked event in the task (at 250Hz sampling rate)
  *   180 trials of the task
  *   3 events/epochs - onset of task, choice taken in task, outcome of task

If I were to plot the average power across all trials for the onset event, I can see how power changes on a spectrogram plot. My goal is to find the significant clusters that show up on the spectrogram as a first step to finding interesting frequency bands. To do so for one subject (with a single DBS lead), I reorganized the data to have these dimensions (180 trials x 3 events x 50 freqs x 500 time) and put it into a fieldtrip struct as follows:

data_ft = [];
data_ft.dimord = 'rpt_chan_freq_time';
data_ft.label = {'Onset','Choice','Outcome'}';
data_ft.freq = linspace(1, 50, 50);
data_ft.time = linspace(-1, 1, 500);
data_ft.powspctrm = data;

where I am using the events as the "channels" so I can choose one at a time.

The cfg for ft_freqstatistics looks like this:
cfg = [];
cfg.method = 'montecarlo';
cfg.statistic = 'indepsamplesT';
cfg.correctm = 'cluster';
cfg.clusteralpha = 0.05;
cfg.clustertail = 0;
cfg.clusterstatistic = 'maxsum';
cfg.tail = 0;
cfg.alpha = 0.025;
cfg.numrandomization = 1000;
cfg.design = ones(size(data_ft.powspctrm, 1), 1); % size = 180 x 1
cfg.ivar = 1;
cfg.channel = {'Onset'};
cfg.neighbours = [];

[stat] = ft_freqstatistics(cfg, data_ft);

following other fieldtrip threads noting that the neighbours field should be left blank to denote clustering in time/frequency rather than spatially across channels. When I run ft_freqstatistics, I get the following error:

Error using findcluster
invalid dimension of spatdimneighbstructmat

Error in clusterstat (line 214)
  posclusobs = findcluster(tmp, connmat, cfg.minnbchan);

Error in ft_statistics_montecarlo (line 364)
  [stat, cfg] = clusterstat(cfg, statrand, statobs);

Error in ft_freqstatistics (line 194)
  [stat, cfg] = statmethod(cfg, dat, design);

The dimension of spatdimneighbstructmat is given by connmat, which is 0 in this case since I didn't specify a neighboring scheme. Is there any other way to cluster in time/frequency and not spatially when looking at only a single channel of data?

Thank you,
Stephanie Brener
UC San Francisco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230807/43f4e5b7/attachment.htm>


More information about the fieldtrip mailing list