[FieldTrip] Fwd: FW: multitaper and NaN

Silvia Pagano silvia.pagano at unitn.it
Wed Jun 27 09:35:12 CEST 2012

Hi all,
Ian Gould, the author of the paper I cited in my previous mail, also
replied to me. He kindly asked me to post his reply on the mailing list.

Thanks again for your help


---------- Forwarded message ----------
From: Ian Gould <ian.gould at psy.ox.ac.uk>
Date: Tue, Jun 26, 2012 at 6:57 PM
Subject: FW: [FieldTrip] multitaper and NaN
To: "Pagano, Silvia" <silvia.pagano at unitn.it>

 Hi Silvia,

 Although I'm not subscribed to  it at the moment, a friend of mine
monitors the field trip email list and forwarded your question to me.

 The boundary effects you are talking about occur because oscillatory
signals  have to be computed over a time window. The time window width is
specified for each frequency you are analysing in cfg.t_ftimwin, and is
centred on the time point you are trying to compute power at. So, if the
half-width of the window is greater than the distance from a time point to
the edge of your data, field trip will not be able to compute power at that
frequency. The solution to this is to (1) use a shorter time window, and/or
(2) calculate data over longer epochs so the boundary effect doesn't affect
the time points you are interested in.

 In  the code you posted, the time window varies with frequency, unlike the
fixed window we used  in our JNeurophys paper. Your  missing data at lower
frequencies are explained by this. For example, you'd need 2.5s of data to
estimate power at 2Hz with your settings. To get 500ms smoothing you could
cfg.t_ftimwin  = 0.5 *ones(1,length(cfg.foi));

 Similarly, for 2Hz smoothing you'd want something like:
cfg.tapsmofrq  = 2*ones(1,length(cfg.foi));

 Finally, for 50ms steps you'd want:
cfg.toi        = -1.1:0.05:0.1;

 Hope that helps. Let me know if any other questions. Also, could you
please post this to the list on my behalf, so others know that your
question has been answered.

 Kind Regards,


  From: Andre Cravo <andrecravo at gmail.com>
Date: Tuesday, 26 June 2012 17:11
To: Ian Gould <ian.gould at psy.ox.ac.uk>, "ian.gould at merton.ox.ac.uk" <
ian.gould at merton.ox.ac.uk>
Subject: Fwd: [FieldTrip] multitaper and NaN

 Hello Ian,

How are you? I hope all is well.

I'm pretty sure you get fieldtrip emails, but I saw this one and thought
you might like to give a help.



---------- Forwarded message ----------
From: Silvia Pagano <silvia.pagano at unitn.it>
Date: 26 June 2012 13:04
Subject: [FieldTrip] multitaper and NaN
To: fieldtrip at science.ru.nl

Dear list subscribers,

 I am an ERPer looking for the first time into the world of time-frequency
analysis. I am trying to perform some multitaper analysis on a data set.
Ideally I would like to perform similar analysis as described in a paper by
Gould et al (2011) on Journal of Neurophysiology. (i.e. in their own words
"Time-frequency analysis was performed on
all epochs using a multitaper approach (2–30 Hz, 0.5-Hz steps, 500-ms
temporal smoothing window, 2-Hz frequency resolution)" )

 I have epochs from -1100 ms to 100 time locked to the stimulus onset and I
am trying to replicate the analysis they did. The problem is that I got
boundary effects on all my conditions, namely I obtain NaN in the extreme
100 ms of the time window for all frequencies and for very low frequencies
(e.g. 2-4Hz) I have no data in the whole time window. I thought I had time
windows large enough to avoid boundary effects, however there must be
something I am missing in my code.

 Here's what I did following the tutorial:

  cfg = [];
cfg.output     = 'pow';
cfg.channel    = 'EEG';
cfg.method     = 'mtmconvol';
cfg.foi        = 2:2:30;
cfg.t_ftimwin  = 5./cfg.foi;
cfg.tapsmofrq  = 0.4*cfg.foi;
cfg.toi        = -1.1:0.02:0.1;
cfg.pad        = 'maxperlen';
TFRmult = ft_freqanalysis(cfg, data);

 Does anyone have a clue on this?

 Thank you very much


Silvia Pagano PhD student
CIMeC - Center for Mind/Brain Science
Corso Bettini, 31 38068 Rovereto (TN)
Tel. +39 0464 808709

fieldtrip mailing list
fieldtrip at donders.ru.nl

Andre M. Cravo
Postdoctoral Researcher
University of Sao Paulo-Brazil


Silvia Pagano PhD student
CIMeC - Center for Mind/Brain Science
Corso Bettini, 31 38068 Rovereto (TN)
Tel. +39 0464 808709
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120627/83552e78/attachment-0001.html>

More information about the fieldtrip mailing list