[FieldTrip] Discrepancy between trialwise and average data using ft_freqanalysis

Dan McCarthy mccarthyd at mail.wou.edu
Wed Sep 4 23:34:47 CEST 2019

Dear list,

I am conducting a trialwise LMM analysis on time-frequency data and
compared my grand averages between two ft_freqanalysis pipelines for sanity
checking. Though the data look qualitatively similar, I noticed the values
are baselined roughly 1.5 dB lower (i.e., values around zero vs. -1.5) for
the grand averages using the cfg.keeptrials = 'yes' option compared to the
cfg.keeptrials = 'no' option.

Here are the processing steps for the keeptrials = 'yes' dataset:

nSteps = 90;

fRange = [1 30]; % Range of frequencies to analyze

nCyc = [2 12]; % range of cycle widths for each freq

cfg = [];

cfg.output = 'pow'; % return power spectra

cfg.channel = 'all';

cfg.method = 'wavelet'; % multipaper method

cfg.foi = linspace(fRange(1),fRange(2),nSteps); % 1 to 30 Hz in 90 steps

cfg.width = linspace(nCyc(1),nCyc(2),nSteps); % width of  wavelets in
number of cycles

cfg.toi = [-3 3]; % time windows of interest

cfg.keeptrials = 'yes';

cfg.baseline = [-.3 0];

cfg.baselinetype = 'db';

for i = 1:nSub

     tfDataSLLoCohQ1{i} = ft_freqanalysis(cfg, eeg{bin1,a});

     tfNormDataSLLoCohQ1{i} = ft_freqbaseline(cfg, tfDataSLLoCohQ1{i});


cfg = [];

% Get subject averages

for j = 1:length(tfNormDataSLLoCohQ1)

    tfNormAvgQ1{j} = ft_freqdescriptives(cfg,tfNormDataSLLoCohQ1{j});


% Get grand average

tfNormGrandAvgQ1 = ft_freqgrandaverage(cfg,tfNormAvgQ1{:});

% Get theta band for frontocentral sites

cfg.channel = {'Cz','FC1','FC2'};

cfg.avgoverchan = 'yes';

cfg.frequency = [4 8];

cfg.avgoverfreq = 'yes';

singleThetaQ1 = ft_selectdata(cfg,tfNormGrandAvgQ1);

In the cfg.keeptrials = 'no' pipeline, all is the same except the option is
switched off and the extra step to get descriptives (ft_freqdescriptives)
is removed before ft_freqgrandaverage as the trials were discarded so the
extra step isn't necessary.

When I plot the theta time course, all the values in the cfg.keeptrials =
'yes' data are shifted roughly 1.5 units down on the y-axis compared to the
cfg.keeptrials = 'no' data.

Has anyone else experienced a similar issue? Any insight into why these two
approaches end up with different results?

Any help is greatly appreciated. Thank you!


Dan McCarthy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190904/4819a145/attachment.html>

More information about the fieldtrip mailing list