[FieldTrip] Question about frequency analysis

Christodoylos Karittevlis christodoylos_k at hotmail.com
Thu Apr 29 09:55:11 CEST 2021


Hi Mr Jan-Mathijs,

Yes you are right , I get 1s all over the place in the case when I use 0 – 0.5 s.

Okay , thank you very much. Apparently , I need to study more about the tapering method used in frequency analysis.

I do have 80 trials and I also have 1 more which is the average .
One more question ,please.
So my coherence estimates for that just 1 trial (which is the average) and just only 6 tapers used, will still be wrong ??

Thank you very much

Kind regards,
Chris


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Schoffelen, J.M. (Jan Mathijs)<mailto:jan.schoffelen at donders.ru.nl>
Sent: Thursday, April 29, 2021 10:43 AM
To: FieldTrip discussion list<mailto:fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] Question about frequency analysis

Hi Chris,

I notice that you only have a single trial in your data. In Fieldtrip, the unit-of-observation that goes into the coherence computation is the so-called ‘rpttap’ dimension, which is the number of trials times the number of tapers applied. If this number is 1, then the coherence will be 1, by mathematical definition.

When the trial length is 0.7 seconds, the specification of tapsmofrq leads to 6 Slepian tapers to be applied (i.e. 2*0.7*5-1), thus to a rpttap of 6 times the number of trials. This brings down the coherence values (but will no doubt still lead to quite biased estimates, because your input just contains a single trial). With only a 0.2 s window selected, the number of tapers will be 1: (2*0.2*5-1), and thus coherence will indeed trivially go to 1 all over the place. I don’t know what happens in the 0.5 s case, though, provided your reported all-ones in this case are indeed observed in this situation as well.

Long story short, you should increase the number of trials in your computation, or ramp up the smoothing parameter (the latter makes you lose spectral resolution, so probably that’s undesired).

Best wishes,
Jan-Mathijs




On 29 Apr 2021, at 09:24, Christodoylos Karittevlis <christodoylos_k at hotmail.com<mailto:christodoylos_k at hotmail.com>> wrote:

Dear Fieldtrip Community,

I am using the function ft_freqanalysis to calculate power spectrum and cross spectrum and after that I calculate the Magnitude Squared Coherence.
The trials are defined to start from -0.200s up to +0.500s .
When I use the function ft_freqanalysis on the whole trial it works fine , Coherence gives values from 0 to 1.
But when I try to use it only for the prestimulus period (e.g -0.2s – 0s ) or only to the poststimulus period (e.g 0 : 0.5s) , I think it does not work correctly because the Magnitude Squared Coherence is equal to 1 for all the pairs of channels .

Do you know if I can calculate the power spectrum and cross spectrum only for prestimulus period or only to the poststimulus period ?

This is the script that I am using :

cfg            = [];
cfg.output     = 'powandcsd';
cfg.method     = 'mtmfft';
cfg.foilim     = [5 100];
cfg.pad        ='nextpow2';
cfg.tapsmofrq  = 5;
cfg.keeptrials = 'yes';
cfg.trials     = [1] ;
freq          = ft_freqanalysis(cfg, data );

data have the structured as the output of ft_preprocessing.
When I want to select only the prestimulus or post stimulus period I am using :
cfg = [];
cfg.latency = [-0.2 0] ;
data_pre = ft_selectdata(cfg,data) ;

% select only the post stimulus period 0:0.2
cfg = [] ;
cfg.latency = [0 0.5];
data_post = ft_selectdata(cfg,data) ;

Thank you in advance!

Kind regards,
Chris

Sent from Mail<https://urldefense.com/v3/__https:/go.microsoft.com/fwlink/?LinkId=550986__;!!HJOPV4FYYWzcc1jazlU!qTYweIa9rVq5IOMpogVpem_hxn63jpoEOR2mm9J786hT9C72LMok_ZxRD46-sN2WZAUbq-_B$> for Windows 10

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!qTYweIa9rVq5IOMpogVpem_hxn63jpoEOR2mm9J786hT9C72LMok_ZxRD46-sN2WZE6-sjJY$<https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!qTYweIa9rVq5IOMpogVpem_hxn63jpoEOR2mm9J786hT9C72LMok_ZxRD46-sN2WZE6-sjJY$>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210429/0a087392/attachment.htm>


More information about the fieldtrip mailing list