Some issues in freqanalysis

Jan Mathijs Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Wed Nov 29 13:01:01 CET 2006

Dear Vladimir,

You can do it when you create a clever statfun_blabla. I assume you are
familiar with the new statistics-framework in fieldtrip.

What you now can do, is to put your reshaped EMG-fourierdata into your
design such that it is "Nvox" (=reshaped channel*freq*time) x Ntapers (do
you use multitapering?).

Important is to append a row to the design which specifies the trial-number
from which the taper was coming from. I guess you should then define this
row-number as the the corresponding cfg.cvar, or uvar, or something.

What your statfun_blabla then should output is the coherence, computed
between the input-data dat (which is the reshaped MEG-fourierspectra), and
the "design". To this end, I would reshape the data back into the original
TFR-dimensions (there should be a dim in the cfg which is passed to the
statfun), and extract the EMG-data from the design, which will be shuffled
in the taper-dimension when running the randomization, which is exactly what
you want, and write some for-loops around the critical computation, which
involves some cross-spectral density computations, according to
fft1*ctranspose(fft2) and power-spectral density computations, according to
diag(fft1*ctranspose(fft1)). In short, the usual business. Do you have some
handles to proceed?




From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of Vladimir Litvak
Sent: Wednesday, November 29, 2006 11:34 AM
Subject: Re: [FIELDTRIP] Some issues in freqanalysis

Dear Eric and Jan-Mathijs,

My reference channel is indeed EMG. I thought about this trial shuffling
idea myself over night. It can actually be combined with clustering in
channel/frequency space. Is there a way to do it with the current version of
statistics routines or should it be programmed by hand?




From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of Jan Mathijs Schoffelen
Sent: Tuesday, November 28, 2006 10:24 PM
Subject: Re: [FIELDTRIP] Some issues in freqanalysis

Dear Vladimir,

Regarding the missing functions: you are absolutely right. The functions
will be added to the latest release.

Regarding the crash: I don't know what is happening there, and I do not have
any experience with the option biascorrect. You'll have to ask Eric about

Does it still crash when you use cfg.biascorrect = 'no'? This might already
solve your problem.

cfg.combinechan is a rather obscure option (and is set to 'no' by default)
in freqdescriptives which is (as far as I know) undocumented. It has to do
with combining planar gradiometer representation back into an axial
gradiometer representation in order to be able to compute coherence between
sensor-combinations (in their original axial representation). As a matter of
fact, it is an option which has a high 'don't try this at home'-content. At
least a correct behavior is not guaranteed. Anyhow, it should run through
even when it is not specified.

If you want to test coherence against 0, the jack-knife estimate of the
variance is not going to help you too much. Rather, you could use some kind
of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001,
or the Z-transformation that is described in James Kilner's papers, or from
the Rosenberg group. In this context, the coherence can be parametrically

Another possibility is using a 'shiftpredictor' to estimate the bias,
meaning that you shuffle the trial order of one of the two channels in your
channel-combination (only works when taking fourier as an output of
freqanalysis). In my experience this only works if you use an external
reference signal, such as the EMG.

Hope this gives some handles,



From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of Vladimir Litvak
Sent: Tuesday, November 28, 2006 8:33 PM
Subject: [FIELDTRIP] Some issues in freqanalysis

Dear Robert and all,

I'm writing a new script for analysis of MEG data and I encountered some
problems with FT (I'm using 20061029 version):

1)       In freqdescriptives the lines 494 and 515 seem to be redundant and
also don't work and cause a crash.

2)       there are some missing functions:

     inputlabel2outputlabel called by freqdescriptives, line 234

     fourier2crsspctrm called by freqdescriptives, line 290

Can you please explain to me what cfg.combinechan in freqdescriptives does
(I'm new to MEG which might explain my ignorance)?

Finally, I would like to compute coherence from data of a single subject
with 300 trials and check whether it is significant (i.e. not random). I
don't think I can use any of the nonparametric stuff because I don't have a
baseline. It seems to me that I should use the jackknife SEMs. How exactly?
Should I use the bias correction? Should I take 2*SEM as the threshold?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the fieldtrip mailing list