[FieldTrip] Simulate data to compare methods
Jörn M. Horschig
jorn at artinis.com
Mon Feb 2 09:25:23 CET 2015
Hi Todor,
you are right that in saying that only one taper shows distinct peaks in all three frequency bands. I dare to say that you chose a rather long signal (something of several seconds), hence the broad frequency smoothing when adding a single taper. As you also indicated, the purpose of using multitapering is not to represent the PSD as 'clean' as possible - then you would need as little smoothing in the frequency domain as possible and therefore use a boxcar taper. In real life, we have noisy signals unfortunately, and most importantly, neurophysiological signals (of higher frequency) are of wide bandwidth, center frequencies of neurophysiological signals vary strongly across participants, etc. All these make your signal imperfect, and are probably properties that you did not simulate.
You can calculate the amount of 'smoothing'/smearing in the frequency domain yourself a priori (2*length of your signal * frequency smoothing = # tapers). The choice of tapering depends thus a lot on what you want. If you want to increase statistical power across observations, where you expect activity in a certain, frequency band, slightly different across observations, possibly contaminated by noise, then multitapers might be the way to go. The advantage is that you have very good control over the bandwidth of your decomposition, and the frequency response is pretty amazing (as you probably saw in the script, additional tapers increase the magnitude of the main lobe while roughly maintaining the magnitude of the side lobes). It all depends on what you want though. We are dealing with tricky signals anyway due to their neurophysiological origin (imperfect sinusoids, lots of noise of different sources, etc.), so we need to choose a method that best suits our needs. Multitapers are one of those that I wouldn't want to miss (in practice mostly when dealing with gamma band responses due to their wide bandwidth). There are more than enough cases where multitapering can also be a pretty bad choice (e.g. when analyzing lower frequencies in shorter trials).
Best,
Jörn
--
Jörn M. Horschig, Software Engineer
Artinis Medical Systems | +31 481 350 980
> -----Original Message-----
> From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-
> bounces at science.ru.nl] On Behalf Of tjordanov at besa.de
> Sent: Friday, January 30, 2015 5:37 PM
> To: 'FieldTrip discussion list'
> Subject: Re: [FieldTrip] Simulate data to compare methods
>
> Hi Eelke, hi Jörn,
>
> thank you for your elaborate answers and for the script - it is very
> informative and useful.
> I am in some extent familiar with the theory behind multitapering and I am
> also convinced that it has very good theoretical properties. However, let us
> take a look at the application. I simulated 200 trials data with jitter in the
> frequency. You can find the frequency profile of the trials as attachment
> ("FrequenciesForSimulation.png"). There are 67 trials with central frequency
> 34 Hz (variation between 32 and 36 Hz), 67 trials with central frequency 50 Hz
> (48 to 52 Hz) and 66 trials with central frequency 66 Hz (64 to 68 Hz). I
> performed multitaper analysis with 1, 2 and 3 tapers (see results
> "Multitaper1taper.png", "Multitaper2tapers.png", "Multitaper3tapers.png").
> As we can see from the results only the decomposition with one taper
> detected correctly the three frequencies, all other two methods (with 2 and
> 3 tapers) just distorted (smoothed) the first result. I can see that such kind of
> smoothing is good for the statistical power between subjects but it does not
> prove the advantage of using multiple tapers compared to using just single
> taper. What do you think?
>
> Best,
> Todor
>
>
> -----Original Message-----
> From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-
> bounces at science.ru.nl] On Behalf Of Jörn M. Horschig
> Sent: Freitag, 30. Januar 2015 13:34
> To: 'FieldTrip discussion list'
> Subject: Re: [FieldTrip] Simulate data to compare methods
>
> Hi Todor,
>
> maybe this matlab function helps illustrating what dpss multitapers are, and
> will thus clarify what makes them so powerful compared to other
> techniques:
> https://www.dropbox.com/s/0uifk9l8rb6m5vl/Tapering.m?dl=0
> (go to example 5)
>
> Best,
> Jörn
>
>
>
> --
>
> Jörn M. Horschig, Software Engineer
> Artinis Medical Systems | +31 481 350 980
>
> > -----Original Message-----
> > From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-
> > bounces at science.ru.nl] On Behalf Of Eelke Spaak
> > Sent: Friday, January 30, 2015 11:52 AM
> > To: FieldTrip discussion list
> > Subject: Re: [FieldTrip] Simulate data to compare methods
> >
> > Hi Todor,
> >
> > Although your procedure would also yield smoothing in the frequency
> > domain which is independent from that in the time domain, it is not at
> > all equivalent to using multitapers!
> >
> > The tapers in the discrete prolate spheroidal sequence (dpss, ==
> > multitaper in fieldtrip) are pairwise orthogonal, hence their
> > estimates are independent from one another. This will result in there
> > being more information extracted from the signal than if you used a
> > single taper and then apply Gaussian smoothing over frequencies. You
> > could have a look at https://en.wikipedia.org/wiki/Multitaper which
> > gives quite a decent overview of multitapering. Or for the full
> > details, refer to the original paper by David Thompson:
> > http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1456701
> >
> > Best.
> > Eelke
> >
> > On 30 January 2015 at 11:10, tjordanov at besa.de <tjordanov at besa.de>
> > wrote:
> > > Hi Eelke,
> > >
> > > I found your answer very interesting. If I understand you correctly,
> > > the
> > advantage of the multitaper method is that it smoothes in the
> > frequency domain independently of the smoothing in the time domain.
> > Then it should be equivalent (or similar) with the following procedure:
> > > 1) Calculate single trial single taper decomposition of the signal.
> > > 2) Choose an appropriate 1D Gauss function (note that it is
> > > important to be 1D else it would smooth in both - time and
> > > frequency)
> > > 3) Apply the selected Gauss function on the decomposed signal only
> > > in the
> > frequency direction (not in time in order to avoid temporal smearing).
> > Do this for all trials and all time points.
> > > 4) Calculate the average over the trials.
> > > In this procedure the choice of the Gaussian would determine the
> > > amount
> > of smearing in the frequency domain.
> > >
> > > Is this so, or I misunderstood something?
> > >
> > > Best,
> > > Todor
> > >
> > >
> > > -----Original Message-----
> > > From: fieldtrip-bounces at science.ru.nl
> > > [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Eelke Spaak
> > > Sent: Mittwoch, 28. Januar 2015 12:24
> > > To: FieldTrip discussion list
> > > Subject: Re: [FieldTrip] Simulate data to compare methods
> > >
> > > Hi Nico,
> > >
> > > As for question (2), you probably first need to think about what
> > > constitutes
> > a "better" result. Using more tapers with dpss will always result in
> > more frequency smoothing. If your source signal is primarily composed
> > of pure sinusoids, and you interpret a spectrum as "better"
> > > if it shows clearer peaks, then you will always get the "best"
> > > result for the
> > single-taper case.
> > >
> > > Multitapering allows optimal control over the amount of smoothing
> > > you
> > obtain in the frequency domain, which is more or less independent of
> > the amount of smoothing you obtain in the time domain (as opposed to
> e.g.
> > wavelets, where these are fundamentally linked). When dealing with
> > brain signals, you will often find that a certain stimulus might
> > induce e.g. a gamma response at 40-50 Hz in one subject and one trial,
> > while in another subject or another trial the same stimulus might
> > induce a 50-60 Hz response or so. Of course, in the average over
> > trials (and subjects), this heterogeneity (i.e.,
> > noise) will wash out, but it will severely damage your statistical sensitivity.
> > Therefore, using multitapers to add smoothing can produce a much more
> > consistent result and therefore be "better" in the sense of actually
> > understanding the brain.
> > >
> > > As for your simulation, perhaps using filtered noise would be better
> > > than
> > sinusoids. Also, since multitapering benefits you most strongly when
> > taking variation over observations into account, you could consider
> > simulating different observations, each consisting of noise filtered
> > in a slightly different randomly chosen bandwidth, and inspecting the
> > resulting variation over observations in the spectra.
> > >
> > > Best,
> > > Eelke
> > >
> > > On 27 January 2015 at 18:36, Max Cantor <mcantor at umich.edu> wrote:
> > >> Hi Nico,
> > >>
> > >> I'm not sure about the second question, but as for the first
> > >> question, you can manually set the scales for ft_singleplotTFR
> > >> using
> > cfg.zlim.
> > >>
> > >> Hope that helps,
> > >>
> > >> Max
> > >>
> > >> On Tue, Jan 27, 2015 at 11:50 AM, Nico Weeger
> > >> <nico.weeger at googlemail.com>
> > >> wrote:
> > >>>
> > >>> Hello FieldTrip community,
> > >>>
> > >>>
> > >>>
> > >>> I am new to FieldTrip and I try to simulate data to compare the
> > >>> ft_frequanalysis methods Hanning, Multitaper and Wavelet.
> > >>>
> > >>> Therefore I simulate Data manually using different latency,
> > >>> amplitude and frequency combinations using the following equation:
> > >>>
> > >>> sig1 = exp(-(t-lat1).^2/(2*sigma1))*amp1.*sin(2*pi*f1*t);
> > >>>
> > >>> sig2 = exp(-(t-lat2).^2/(2*sigma2))*amp2.*sin(2*pi*f2*t);
> > >>>
> > >>> sig3 = exp(-(t-lat1).^2/(2*sigma1))*amp1.*sin(2*pi*f2*t);
> > >>>
> > >>> sig4 = exp(-(t-lat2).^2/(2*sigma2))*amp2.*sin(2*pi*f1*t);
> > >>>
> > >>> sig = sig1+sig2+sig3+sig4;
> > >>>
> > >>> where amp1=20; amp2 = 5; lat1= 1.7; lat2 = 2.3; f1 = 12; f2 = 60;
> > >>>
> > >>>
> > >>> After using ft_frequanalysis (see the following cfgs)
> > >>>
> > >>>
> > >>> Cfg Wavelet:
> > >>>
> > >>> cfg = [];
> > >>>
> > >>> cfg.output = 'pow';
> > >>>
> > >>> cfg.channel = labels;
> > >>>
> > >>> cfg.method = 'wavelet';
> > >>>
> > >>> cfg.width = 7;
> > >>>
> > >>> cfg.gwidth = 3;
> > >>>
> > >>> cfg.foilim = [1 70];
> > >>>
> > >>> cfg.toi = 0:0.05:2;
> > >>>
> > >>> TFRwave = ft_freqanalysis(cfg, data_preproc);
> > >>>
> > >>>
> > >>>
> > >>> Cfg Hanning / Multitaper:
> > >>>
> > >>> cfg = [];
> > >>>
> > >>> cfg.output = 'pow';
> > >>>
> > >>> cfg.channel = labels;
> > >>>
> > >>> cfg.method = 'mtmconvol'
> > >>>
> > >>> cfg.foi = 1:1:70
> > >>>
> > >>> cfg.tapsmofrq = 0.2*cfg.foi;
> > >>>
> > >>> cfg.taper = 'dpss' / ‘hanning’;
> > >>>
> > >>> cfg.t_ftimwin = 4./cfg.foi;
> > >>>
> > >>> cfg.toi = 0:0.05:2;
> > >>>
> > >>> TFRmult1 = ft_freqanalysis(cfg, data_preproc);
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> the data is plotted with ft_singleplotTFR (see cfg below)
> > >>>
> > >>>
> > >>> cfg singleplot:
> > >>>
> > >>> cfg = [];
> > >>>
> > >>> cfg.maskstyle = 'saturation';
> > >>>
> > >>> cfg.colorbar = 'yes';
> > >>>
> > >>> cfg.layout = 'AC_Osc.lay';
> > >>>
> > >>> ft_singleplotTFR(cfg, TFRwave);
> > >>>
> > >>>
> > >>> Two problems occur. First, the power scale of wavelet and
> > >>> Multitaper/Hanning differs extremely (Multi 0-~100 and Wavelet 0-
> > ~15*10^4).
> > >>>
> > >>> 1. How can I get the scale of all methods equal, or do I have to
> > >>> change the Wavelet settings to get the right scale of the values?
> > >>>
> > >>> Second, the best result of Multitaper analysis is performed using
> > >>> only one Taper. The goal was to get a result, where the advantages
> > >>> and disadvantages of Multitaper analysis compared to the other
> > methods can be seen.
> > >>>
> > >>> 2. How can I change the simulation so that more tapers show better
> > >>> results than a single taper does?
> > >>>
> > >>>
> > >>> Thank you for your time and help.
> > >>>
> > >>>
> > >>> Regards,
> > >>>
> > >>>
> > >>>
> > >>> Nicolas Weeger
> > >>>
> > >>> Student of Master-Program Appied Research,
> > >>>
> > >>> University Ansbach,
> > >>>
> > >>> Germany
> > >>>
> > >>>
> > >>> _______________________________________________
> > >>> fieldtrip mailing list
> > >>> fieldtrip at donders.ru.nl
> > >>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> > >>
> > >>
> > >>
> > >>
> > >> --
> > >> Max Cantor
> > >> Lab Manager
> > >> Computational Neurolinguistics Lab
> > >> University of Michigan
> > >
> > > _______________________________________________
> > > fieldtrip mailing list
> > > fieldtrip at donders.ru.nl
> > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> > >
> > >
> > > _______________________________________________
> > > fieldtrip mailing list
> > > fieldtrip at donders.ru.nl
> > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> >
> > _______________________________________________
> > fieldtrip mailing list
> > fieldtrip at donders.ru.nl
> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
More information about the fieldtrip
mailing list