fourierspectra and freqstatistics

Jasper Poort j.poort at NIN.KNAW.NL
Wed Aug 5 10:43:29 CEST 2009

Dear all, I have the following question

I want to compare the powerspectra in two conditions for individual

When I first run freqanalyis with

cfg.output      = 'pow';

cfg.method      = 'mtmconvol';

cfg.keeptrials  = 'yes';

this results in a power spectrum for two conditions:

size(A.powspctrm): 943     1    19    48 ntrials x nchannels x nfrequency x

size(A.cumtapcnt): 943    19

I can then compare the powerspectra in two conditions by running
freqstatistics with:

cfg = [];

cfg.method    = 'analytic';

cfg.statistic = 'indepsamplesT';

ntrl1 = size(A.powspctrm,1);

ntrl2 = size(B.powspctrm,1);

design = zeros(1,ntrl1 + ntrl2);

design(1,1:ntrl1) = 1;

design(1,(ntrl1+1):(ntrl1+ntrl2)) = 2;      = design;

cfg.ivar        = 1; % independent variable

stat = freqstatistics(cfg,A, B);

differencepowspctrm = stat.stat;

However, when I use freqanalyis with

cfg.output      = 'fourier';

this results in a fourier spectrum for two conditions:

size(A.fourierspctrm):  4715    1          19          48 (ntapers (in my
case 5) x ntrials) x nchannels x nfrequency x ntime

size(A.cumtapcnt)    :  943     1

Can I input these fourier spectra directly to freqstatistics or should I
convert the fourierspectrum first to a powerspectrum (I assume this could be
done by taking abs(fourierspectrum).^2 and then averaging over tapers for
every trial ) ?

Alternatively, is it at all possible to first run freqdescriptives and then
input the averages and  variance into freqstatistics (since this is the only
thing necessary for the independent t-test)?

Many thanks in advance, best, Jasper

The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the fieldtrip mailing list