[FieldTrip] Single trial dB baseline correction

Bekke, M.E. ter (Marlijn) marlijn.terbekke at donders.ru.nl
Thu Feb 16 15:09:26 CET 2023


Hi Mireia,



I’ve been encountering a similar problem this week, where baselining after ft_freqanalysis with keeptrials = ‘yes’ gives unexpected results. I found this message from Jan-Mathijs Schoffelen online:



“With keeptrials = 'yes', the baseline correction is applied to every single trial, with keeptrials = 'no', the baseline correction is only applied to the average. Since the baseline operation that you have specified is the result of a division, this yields different results. In general, first averaging, then baseline correcting makes more sense.” (https://urldefense.com/v3/__https://github.com/fieldtrip/fieldtrip/issues/670__;!!HJOPV4FYYWzcc1jazlU!9ZMUVm3KHFhKEJIxX50B-SHHjYkPYFKdHS6dyDVryLWDQ1AUEhQnEy8RqjuGK2pChzi96-Dnja_fkfEYpkJHxLESXecWTuNeQu8p2w$ )



So I think this would align with the fact that when you used a baseline that using division (db), you got the unexpected results, but not with the baseline that doesn’t involve division (absolute).



Jan-Mathijs mentions that in general first averaging makes more sense, but when you want to do single-trial analyses that’s of course not possible. In my case, I wanted to use ‘relchange’ to baseline, but doing so on the data with keeptrials = ‘yes’ shows a power increase in my crucial time window with respect to baseline, while doing so with keeptrials = ‘no’ shows a power decrease (as expected) (I’ve attached pictures for one participant as an example).



I would be very curious to hear what baseline procedure people recommend for single-trial analyses!



Best,

Marlijn





Marlijn ter Bekke<https://urldefense.com/v3/__https://www.mpi.nl/people/bekke-marlijn-ter__;!!HJOPV4FYYWzcc1jazlU!9ZMUVm3KHFhKEJIxX50B-SHHjYkPYFKdHS6dyDVryLWDQ1AUEhQnEy8RqjuGK2pChzi96-Dnja_fkfEYpkJHxLESXecWTuOqFZ44OA$ >

PhD student @Donders Centre for Cognition

& Max Planck Institute for Psycholinguistics

https://urldefense.com/v3/__https://marlijn-ter-bekke.github.io/__;!!HJOPV4FYYWzcc1jazlU!9ZMUVm3KHFhKEJIxX50B-SHHjYkPYFKdHS6dyDVryLWDQ1AUEhQnEy8RqjuGK2pChzi96-Dnja_fkfEYpkJHxLESXecWTuNRHI8EnQ$ 





From: fieldtrip <fieldtrip-bounces at science.ru.nl> On Behalf Of TORRALBA CUELLO, MIREIA via fieldtrip
Sent: Wednesday, 15 February 2023 17:15
To: fieldtrip at science.ru.nl
Cc: TORRALBA CUELLO, MIREIA <mireia.torralba at upf.edu>
Subject: [FieldTrip] Single trial dB baseline correction





Dear FieldTrip community,



I came across a problem when using dB baseline correction for single trial power-spectrum time courses. My problem is that all values turn to be negative, even in the baseline. When I averaged across trials and subjects, to see if this was noise, I found that the values in the baseline were around -1 dB. I am using revision 20220104.



When I inspected the function ft_freqbaseline, I came to see that the dB transformation is calculated after averaging the power in the temporal domain. That is:

I calculate power spectrum:

cfg=[];
cfg.method='mtmconvol';       %STFT
cfg.taper='hanning';       %Taper window used
cfg.pad='nextpow2';
cfg.foi=5:1:7;     %Frequencies of interest (in Hz)
cfg.toi=-0.5-0.24:0.05:1.5;
cfg.t_ftimwin=0.5*ones(length(cfg.foi),1);
cfg.keeptrials='yes';        %We will inspect only the average power
cfg.output='pow';

fdata=ft_freqanalysis(cfg,data);



In ft_freqbaseline:

meanVals = repmat(nanmean(data(:,:,baselineTimes), 3), [1 1 size(data, 3)]);

Then, the dB transform is calculated as follows:

data = 10*log10(data ./ meanVals);



As I mentioned, when I apply this procedure to my data using the following setting:

cfg=[];
cfg.baseline=[-0.5 0];
cfg.baselinetype='db';
fdata_baseline=ft_freqbaseline(cfg,fdata);



 I get very negative values in the baseline. However, if I first do the transform and then the baseline like this:



cfg=[];
cfg.operation='10*log10(x1)';
cfg.parameter='powspctrm';
fdata_log=ft_math(cfg,fdata);



cfg=[];
cfg.baseline=[-0.5 0];
cfg.baselinetype='absolute';
fdata_baseline=ft_freqbaseline(cfg,fdata_log);



Taking advantage of the properties of the logarithm, then for trial and subject averaged data I obtain what I should expect, that the values in the baseline period are small and fluctuating around zero.



I don't know, maybe the approach for calculating dB correction should be different for single and trial averaged power spectrum. Or maybe there was some error in my procedure.



Thanks in advance,



Mireia

Mireia Torralba Cuello

Multisensory Research Group

Center for Brain and Cognition, Universitat Pompeu Fabra

Address: Edifici Mercè Rodoreda 24.313
        c\ Ramon Trias Fargas, 25-27
        08005 Barcelona

https://urldefense.com/v3/__http://www.mrg.upf.edu__;!!HJOPV4FYYWzcc1jazlU!9ZMUVm3KHFhKEJIxX50B-SHHjYkPYFKdHS6dyDVryLWDQ1AUEhQnEy8RqjuGK2pChzi96-Dnja_fkfEYpkJHxLESXecWTuPeHjr-7g$ <https://urldefense.com/v3/__http:/www.mrg.upf.edu/__;!!HJOPV4FYYWzcc1jazlU!4sCV7xFJiK_VsVjZKxw5wNhPArLa1bmn6sjBfkf4XUH6MHmklClR3K21eGCks43NgrUUJ-t_-sYBqdsDMHjdgCs49R3n0Spy$>

Tel +34 935422745

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230216/8a45587c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pp1_relchange_keepno.png
Type: image/png
Size: 19570 bytes
Desc: pp1_relchange_keepno.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230216/8a45587c/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pp1_relchange_keepyes.png
Type: image/png
Size: 15069 bytes
Desc: pp1_relchange_keepyes.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230216/8a45587c/attachment-0001.png>


More information about the fieldtrip mailing list