[FieldTrip] ft_freqgrandaverage

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Fri Feb 8 12:37:58 CET 2013

Hi Patrick,

I think you have to write this yourself.  I never tried though, so maybe 
there is a way.

It's a tricky thing to what you want, so I guess that's why it is not 
implemented. If you average for some time bins over less repetitions 
than for others, you get a weaker noise estimate, thereby any effects 
found or not found could be attributed to plain noise. Put in another 
way, depending on what analysis you are doing, you might get into 
trouble with your statistics because of different degrees of freedom per 
time bin. Also note that for frequency data, power has only positive 
values with a lower bound of zero, thus noise can only increase the 
power estimate and not cancel out (so more noise = more power), thus a 
difference in a later time bin between conditions might be explained by 
having lower df (fewer observations, more noise) in one condition than 
in the other, especially if power is greater in the condition with fewer 

I would strongly suggest to throw out trials which do not reach your 
time of interest and process only these (i.e. throw out that one 
subject) unless you really know what you are doing. On the other hand as 
already mentioned, I never tried and never did this, so maybe there is 
some neat way to achieve what you want (you'd be probably notice, cause 
people would reply to this response rather fast).


On 2/8/2013 12:06 PM, Jung, Patrick wrote:
> Hi Fieldtrippers,
> To get a feeling of my data I want to visually inspect the data and 
> look where are differences between the conditions
> by plotting the grand-averages of TFRs.
> By using *ft_freqgrandaverage*I noticed that it gives back *NaN*
> if freq entries for one time bin are missing for one subject (n=28).
> 1.sSTOP, 2. cAC,                                                 3. diff
> In my data with variable trial lengths, the shortest poststim time 
> point is around 0.06 s in one condition (cAC) and in one subject
> but I expect my effects around 0.1-0.35 s.
> How can I overcome this problem? Is there a more appropriate fieldtrip 
> function or do I have to write a special self-made Matlab code?
> Here is an excerpt of my code:
> GA_sSTOP = ft_freqgrandaverage(cfg, AllSubjMat_sSTOP{1,:});
> % where AllSubjMat_sSTOP contains TFRs of all subjects in a <1x28 cell>
> GA_cAC = ft_freqgrandaverage(cfg, AllSubjMat_cAC{1,:});
> GA_diff.powspctrm = (GA_sSTOP.powspctrm - GA_cAC.powspctrm) ./ 
> (0.5*GA_sSTOP.powspctrm + 0.5*GA_cAC.powspctrm);
> Many thanks for your help!
> Cheers,
> Patrick
> **
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130208/7d22e700/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 11890 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130208/7d22e700/attachment-0002.jpe>

More information about the fieldtrip mailing list