[FieldTrip] Error using indepsamplesZcoh function for calculating coherence differences

Bushra Riaz Syeda bushra.riaz at gu.se
Tue May 18 15:36:49 CEST 2021


Hello,

Thank you for your reply. I am stuck with this for couple of days now.
 >Can you please specify the cfg to ft_freqstatistics as well? Otherwise, we don’t know what you did exactly.

cfg            = [];

cfg.method = 'montecarlo';

cfg.statistic = 'indepsamplesZcoh';

cfg.design(1,1:148)=1;

cfg.design(1,149:296)=2;

cfg.numrandomization = 1000;

cfg.correctm         = 'cluster';

cfg.neighbours=[];

cfg.parameter='crsspctrm';

cfg.alpha            = 0.05;

cfg.clusteralpha     = 0.05;

stat=ft_freqstatistics(cfg,freq_coh);

Sorry I didnt follow this point. I am calling freqstatistics with above cfg parameters


>Also, ft_freqstatistics with cfg.statistic = ’indepsamplesZcoh’ requires frequency data that has been computed with >‘fourier’ rather than ‘powandcsd’ as cfg.method for ft_freqanalysis

when freq_coh is calculated with fourier method, then above code give following error

Error using ft_freqstatistics (line 177)
the length of the design matrix (1) does not match the number of observations in the data (2072)

It seems as if the dimord for fourier data is not read correctly, rpttap_chan_freq is getting confused with rpt_chan_freq as 2072 are rpttap , number of repetitions are only 296

The error can be reproduced by running following script
https://www.dropbox.com/s/7bupsr8gkdmy28c/testcode.m?dl=0
with this data
https://www.dropbox.com/s/6gfj97srttteawy/Coh_data.mat?dl=0

Thank you
Kind regards
Bushra Riaz
________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Schoffelen, J.M. (Jan Mathijs) <jan.schoffelen at donders.ru.nl>
Sent: 18 May 2021 14:05
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] Error using indepsamplesZcoh function for calculating coherence differences

Hi Bushra,

Can you please specify the cfg to ft_freqstatistics as well? Otherwise, we don’t know what you did exactly.

Also, ft_freqstatistics with cfg.statistic = ’indepsamplesZcoh’ requires frequency data that has been computed with ‘fourier’ rather than ‘powandcsd’ as cfg.method for ft_freqanalysis

Best wishes,
Jan_Mathijs


On 14 May 2021, at 13:36, Bushra Riaz Syeda <bushra.riaz at gu.se<mailto:bushra.riaz at gu.se>> wrote:

Hello,
I am trying to do the analysis based on the paper "nonparametric statistical testing of coherence differences" in fieldtrip for comparing differences between two conditions on single subject level.

I am using the following code

cfg            = [];
cfg.method = 'montecarlo';
cfg.statistic = 'indepsamplesZcoh';
cfg.design(1,1:148)=1;
cfg.design(1,149:296)=2;
cfg.numrandomization = 1000;
cfg.correctm         = 'cluster';
cfg.neighbours=[];
cfg.parameter='crsspctrm';
cfg.alpha            = 0.05;
cfg.clusteralpha     = 0.05;
stat=ft_freqstatistics(cfg,freq_coh);


Where freq_coh is calculated as
cfg            = [];
cfg.output     = 'powandcsd';
cfg.method     = 'mtmfft';
cfg.foilim     = [1 40];
cfg.tapsmofrq  = 2;
cfg.pad = 'nextpow2';
cfg.keeptrials = 'yes';
freq_coh          = ft_freqanalysis(cfg, Coh_data);

I am getting the following error

Error using ft_statistics_montecarlo (line 250)
could not determine the parametric critical value for clustering

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

Sample data can be found at the following link
https://www.dropbox.com/s/6gfj97srttteawy/Coh_data.mat?dl=0<https://urldefense.com/v3/__https://www.dropbox.com/s/6gfj97srttteawy/Coh_data.mat?dl=0__;!!HJOPV4FYYWzcc1jazlU!rzdciE12ryfrSpIQp-4LAZj3EK_9U0i1XJby6k79PqsvZKuG4jrCMN-qjHXKDzonA-cj5upg$>
[https://www.dropbox.com/static/images/spectrum-icons/generated/content/content-unknown-large.png]<https://urldefense.com/v3/__https://www.dropbox.com/s/6gfj97srttteawy/Coh_data.mat?dl=0__;!!HJOPV4FYYWzcc1jazlU!rzdciE12ryfrSpIQp-4LAZj3EK_9U0i1XJby6k79PqsvZKuG4jrCMN-qjHXKDzonA-cj5upg$>
Coh_data.mat<https://urldefense.com/v3/__https://www.dropbox.com/s/6gfj97srttteawy/Coh_data.mat?dl=0__;!!HJOPV4FYYWzcc1jazlU!rzdciE12ryfrSpIQp-4LAZj3EK_9U0i1XJby6k79PqsvZKuG4jrCMN-qjHXKDzonA-cj5upg$>
Shared with Dropbox
www.dropbox.com<https://urldefense.com/v3/__http://www.dropbox.com__;!!HJOPV4FYYWzcc1jazlU!rzdciE12ryfrSpIQp-4LAZj3EK_9U0i1XJby6k79PqsvZKuG4jrCMN-qjHXKDzonA7PXFKq_$>

any help would be highly appreciated
Kind regards
Bushra Riaz
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!rzdciE12ryfrSpIQp-4LAZj3EK_9U0i1XJby6k79PqsvZKuG4jrCMN-qjHXKDzonA0G39K1J$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210518/3fcba0e7/attachment.htm>


More information about the fieldtrip mailing list