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

Brener, Stephanie Stephanie.Brener at ucsf.edu
Tue Aug 8 23:31:57 CEST 2023


Hi Jan-Mathijs,

Thank you for your response. In my analysis, I am not trying to compare between the Onset event and the Choice event. I only want to find clusters in time/frequency across all trials in just the Onset event (then repeat for the Choice event). The goal is to do the standard clustering method, like described here: https://urldefense.com/v3/__https://natmeg.se/ft_statistics/statistics.html__;!!HJOPV4FYYWzcc1jazlU!8vz-0y-BMtBAed_rHKBjXtLBx5_dTvhl5rch206OvsW0fQKUcFx778iHe96MJFEyagz0ziEo3P8heHy0Igib3HrN05LEKOnBYg$ , for the case where there is only one spatial channel. The statistical test will be checking whether the population mean (across all trials) is different than 0, rather than different from another population. Various posts have mentioned that the way to find clusters by time/frequency instead of spatially is by leaving the cfg.neighbours field blank. However, I still run into errors when doing that. Do you have any insight into finding clusters in time/frequency?

Thank you,
Stephanie
________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Schoffelen, J.M. (Jan Mathijs) via fieldtrip <fieldtrip at science.ru.nl>
Sent: Tuesday, August 8, 2023 10:36 AM
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: Schoffelen, J.M. (Jan Mathijs) <janmathijs.schoffelen at donders.ru.nl>
Subject: Re: [FieldTrip] Cluster based permutation test for single channel, ft_freqstatistics

Hi Stephanie, I think that there is something wrong with what you want to achieve (at least what I think you want to achieve), and the way you try to achieve it. If you want to make a comparison between the onset/choice/outcome segments of
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.

ZjQcmQRYFpfptBannerEnd
Hi Stephanie,

I think that there is something wrong with what you want to achieve (at least what I think you want to achieve), and the way you try to achieve it.

If you want to make a comparison between the onset/choice/outcome segments of your data, you should NOT artificially represent them as different channels. Rather, you’d need to represent each of the individual (sub-)segments of the individual trials (if you want to use the trials as a unit of observation) as separate data matrices, or the average per (sub-)segment across trials for each patient (if you want to use the patient as a unit of observation). Then, if you want to use a(n in)dependent T-statistic as the test statistic, you can only do a pairwise comparison, and this means that the specified design should contains 1’s and 2’s.

I would expect you to create 3 data structures, one for each part of the trial onset/choice/outcome, which can be either compared in a pairwise fashion using (in)depsamplesT, or in a single shot, using an F-statistic. Note, that given the presence of a time dimension, there’s a hard requirement that the time axes for each of the conditions has the same number of time points (and that the corresponding time axis should be faked to be numerically identical across the three conditions) in order for the FT-machinery to work. I think it would make sense to collapse across time in the first instance, because my hunch is that 1) the condition that I mentioned in the previous sentence is not met in your data, and 2) I don’t know whether there is a specific physiological reason to assume that it is meaningful to compare in a pairwise fashion -say- the power at x ms after task onset with the power at exact x ms after choice onset.

Good luck,
Jan-Mathijs


On 7 Aug 2023, at 20:46, Brener, Stephanie via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

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
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://urldefense.com/v3/__https://mailman.science.ru.nl/mailman/listinfo/fieldtrip__;!!LQC6Cpwp!qZKfpBRRtXD-MhJNgK8Umx7bPEupxVdrVdeMrETazqQDeha0_MbS_da176LrjM7A3I0fRDP8yENOe5wA5VfOGjRg_4fr9g$>
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!8vz-0y-BMtBAed_rHKBjXtLBx5_dTvhl5rch206OvsW0fQKUcFx778iHe96MJFEyagz0ziEo3P8heHy0Igib3HrN05LOoxGhTg$ <https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!6lvoYv-5AUVQgVqdkunLQW47GM9q2ZAfISkCDDLA_izYMc74Be5DxwaonX_MSWy1cdx5IUlflE2Mdlb_DmEgVJkDp15TAJ724jS-WQ$>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230808/2cec6b44/attachment.htm>


More information about the fieldtrip mailing list