[FieldTrip] Cluster based permutation test between trials (conditions)

Meedy P. meedy.p at hotmail.de
Tue Jun 25 21:23:40 CEST 2024


Hi Jan-Mathijs,

Thanks for the swift reply!
I believe there is a meaningful connection, hence I modified my code to fit the paired test-statistic.
Thanks for the advice!

All the best,
Meedy


Am 24.06.2024 um 15:55 schrieb Schoffelen, J.M. (Jan Mathijs) via fieldtrip <fieldtrip at science.ru.nl>:

 Hi Meedy Phung,

If your trials are paired across conditions, i.e. there is a meaningful connection between the x’th trial in condition 1, and the y’th trial in condition 2, you can use a paired test-statistic (a.k.a. depsamplesT). If the former conditions is not fulfilled, you should use an unpaired test statistic (a.k.a. indepsamplesT)

Best wishes and good luck,
Jan-Mathijs


On 20 Jun 2024, at 17:44, Meedy Phung via fieldtrip <fieldtrip at science.ru.nl> wrote:

Hi fieldtrip community!

I'd be grateful for insights on the cluster based permutation test between trials of a single subject.

First some info:
I have EEG data from 3 patients, all of them conducted the same experiment and I have trials of different conditions.
Specifically, I have binary answers of 'yes' and 'no' and baselines preceding the yes/no answers

I only want to test within a single subject, for example difference between yes and the baseline for subject i

I am looping through subjects, days and sessions and this is the config for the test:

% initialize cell array for yes/baseline stat results for each patient
stat_yesbl_delta= cell(nsubj, 1);

% test null-hypothesis of exchangeability between YES and BASELINE YES
for subi = 1:nsubj
stat_yesbl_delta{subi} = cell(1, numel(tfpow_yes{subi})); % cell for each day
for dayi = 1:numel(tfpow_yes{subi})
stat_yesbl_delta{subi}{dayi} = cell(1, numel(tfpow_yes{subi}{dayi})); % cell for each session
for sessi = 1:numel(tfpow_yes{subi}{dayi})

% design matrix for the statistical evaluation
design = [ones(1, length(tfpow_yes{subi}{dayi}{sessi}.trialinfo)), ones(1, length(tfpowbase_yes{subi}{dayi}{sessi}.trialinfo))*2];

% config
cfg = [];
cfg.channel = 'all';
cfg.latency = 'all';
cfg.frequency = [1 4]; % theta(4-8) and alpha(8-13) // beta(13-30), gamma(30-45), delta(1-4)
cfg.method = 'montecarlo';
cfg.statistic = 'indepsamplesT'; % independent or dependent??
cfg.correctm = 'cluster';
cfg.clusterstatistic = 'maxsum';
cfg.clustertail = 0;
cfg.clusteralpha = 0.05; % alpha level of the sample-specific test statistic that will be used for thresholding
cfg.alpha = 0.025; % corresponding to a false alarm rate of 0.05 in a two-sided test
cfg.tail = 0; % one-sided (-1 or 1) or two-sided (0) test
cfg.correcttail = 'prob';
cfg.numrandomization = 10000;
cfg.design = design;
cfg.neighbours = []; % clustering done along the freq and time dimensions
cfg.ivar = 1; % row in design indicating condition

stat_yesbl_delta{subi}{dayi}{sessi} = ft_freqstatistics(cfg, tfpow_yes{subi}{dayi}{sessi}, tfpowbase_yes{subi}{dayi}{sessi});

end
end
end

As you can see i have been using cfg.statistic = 'indepsamplesT';
I have read though in some other papers that they used 'depsamplesT' for tests within a single subject and i asked chatgpt and he confirmed it.

I chose 'indepsamplesT' though because based from the tutorial here: https://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq/#between-trial-experiments
This should be a between trial experiment?

I am quite confused which is correct. I am sorry if this question seems trivial, I am quite new to this field.

However, when testing the 'depsamplesT' statistic, i am getting this error:
Error using ft_statistics_montecarlo could not determine the parametric critical value for clustering
Error in ft_freqstatistics (line 194) [stat, cfg] = statmethod(cfg, dat, design); explain
While when i am using 'indepsamplesT' i am getting no error.
I'd be grateful for any help and advice!

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240625/fa105ec7/attachment.htm>


More information about the fieldtrip mailing list