# [FieldTrip] Questions about time frequency analysis of EEG data

Steinmann, Iris iris.steinmann at med.uni-goettingen.de
Thu Nov 24 17:02:26 CET 2016

```Hi Stan,

The permutation test you suggested is exactly what I have done. But it gives me “only” the time-frequency bins that show a significant difference between TFR(A) and TFR(B). To visualize which of the conditions has higher or lower activity in the significant time-frequency bins I want to show a subtraction plot (TFR(A) minus TFR(B))

So, I’m not sure if I understood your answer correctly but I’m still struggling with the same two questions:

1.      Is there anything wrong with subtracting TFR’s after baseline correction?

2.      Is it anyhow valid to perform a linear operation (subtraction) on squared data (TFR)

Sorry for still bothering you with this topic, but if anyone has an easy explanation, I would really appreciate.
Thanks!
Iris

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Pelt, S. van (Stan)
Sent: Donnerstag, 24. November 2016 11:12
To: FieldTrip discussion list
Subject: Re: [FieldTrip] Questions about time frequency analysis of EEG data

Hi Iris,

I assume that you want to compare if spectra are different between these conditions. In that case, I would advise you to take a look at the Fieldtrip TFR-statistics tutorial, http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq. it explains how you can use cluster-based permutation to look for differences between spectra, within or between subjects. In your case, instead of comparing a baseline with an activation epoch (as described in the tutorial), you compare your (baseline-corrected) conditions A and B.

Best,
Stan

From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Steinmann, Iris
Sent: maandag 21 november 2016 13:18
To: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Subject: Re: [FieldTrip] Questions about time frequency analysis of EEG data

Hi Stan,

thanks for your answer. Since I’m working on a similar problem it also helped me a lot.
Would be great if you can answer me two more questions about subtracting time-frequency spectra:

1.       Before subtracting two spectra, I baseline corrected them (ft_frequbaseline, ‘relchange’) (to circumvent the problem Arti described below)

cfg_bc = [];

cfg_bc.baseline = [-2 -1.8];

cfg_bc.baselinetype = 'relchange';

cfg_bc.parameter = 'powspctrm';

A_bc = ft_freqbaseline(cfg_bc, A);

B_bc = ft_freqbaseline(cfg_bc, B);

cfg_m = [];

cfg_m.operation = 'subtract';

cfg_m.parameter = 'powspctrm';

AB_diff = ft_math(cfg_m,  A_bc, B_bc);

Is there anything wrong doing it like this (except I’m not able to change the baseline conditions afterwards…)

2.       Is it really viable to perform a linear operation (subtraction) on squared data (spectra). I mean, a lot of people are doing, so it should be somehow reliable…but I’m still wondering…

Iris

From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Pelt, S. van (Stan)
Sent: Mittwoch, 16. November 2016 08:58
To: FieldTrip discussion list
Subject: Re: [FieldTrip] Questions about time frequency analysis of EEG data

Dear Arti,

My guess is that is has to do with plotting relative change instead of e.g. absolute change. In the individual conditions, you plot relative change to their own baselines, which is in the order of 0.2 or so.
Now when you subtract the 2 conditions, the difference in both baseline and activation epoch is probably small. So when you plot the tfr of this, normalized by the baseline wpoch values of this difference signal, it might blow up the relative change values. You might want to plot just the absolute values of the difference TFR, since it is the difference in the activation window that is most relevant to you (assuming that baseline values are not different between the conditions. Or you could contrast just the activation epochs (e.g., using the tfr of cond1 as ‘baseline’ for cond2), and plot relative change of that.

I’ll illustrate it with some example values to show what I think goes ‘wrong’:

Cond. 1: baseline: 4; activation 6; -> rel.change 0.5 (50% increase)
Cond. 2: baseline 3.9; acitivation 6.3; -> rel change 0.6 (60% increase)
Difference: baseline 0.1; activation 0.3 -> rel change 2.0 (200% increase)

Best,
Stan

--
Stan van Pelt, PhD
Donders Institute for Brain, Cognition and Behaviour
Montessorilaan 3, B.01.34
6525 HR Nijmegen, the Netherlands
tel: +31 24 3616288

From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Arti Abhishek
Sent: woensdag 16 november 2016 5:09
To: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Subject: [FieldTrip] Questions about time frequency analysis of EEG data

Dear fieldtrip community,
I am running time frequency analysis on my EEG data and when I subtract the response between conditions, the difference condition has much higher amplitude. Could someone suggest what is wrong here?

https://www.dropbox.com/s/kh5uzz8000fmh1b/tfr.pdf?dl=0
and here is my script

cfg                      = [];
cfg.trials              = find(s01_ica_clean_artrel_reref.trialinfo==102);
cfg.channel          = 'EEG';
cfg.method           = 'wavelet';
cfg.width              = 7;
cfg.output             = 'pow';
cfg.foi                  = 2:2:40;
cfg.toi                  = -0.4:0.02:0.5;
s01_cond1           = ft_freqanalysis(cfg, s01_cond1_preprocess);
% difference
cfg=[];
cfg.parameter='powspctrm';
cfg.operation ='x1-x2';
s01_difference     =ft_math(cfg, s01_cond1, s01_cond2);
% plot
cfg                     = [];
cfg.baseline=[-0.4 -0.1];
cfg.zlim=[-0.5 0.5];
cfg.xlim=[-0.4 0.5];
cfg.baselinetype = 'relchange';
cfg.layout              = lay;
cfg.interactive         = 'yes';
cfg.channel={'FZ'};
subplot (1,3,1)
ft_singleplotTFR(cfg, s01_cond1);
title('deviant');
subplot (1,3,2);
ft_singleplotTFR(cfg, s01_cond2);
title('standard');
subplot (1,3,3)
ft_singleplotTFR(cfg, s01_difference);
title('difference');
Thanks,
Arti
-------------- next part --------------
An HTML attachment was scrubbed...