# [FieldTrip] problem in connectivityanalysis

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Tue May 21 08:31:22 CEST 2013

Dear Gabriel,

> A) As you see, this makes an average over the epochs of each channel,
> and not over the samples (which in this case are the 9 frequencies of
> the FFT), And I would like to have the opposite, this is, to get the
> imaginary part of coherence for each epoch (repetition) on all my
> channels and not for each frequency, something like: chan_chan_rpt or
> chancbm_rpt, Is this possible?

No. You should think of coherence more as a measure for the consistency
of the phase relation between channels across trials, so coherence is
just not defined per trial,neither would it make sense to compute
coherence for a single trial.

> B) Another question I have is: for the Imaginary part of Coherence is
> not necessary to compute the cross-spectrum with 'powandcsd', only the
> FFT, but for the PLV, PPC or WPLI is that way too?
I see some terminology issues here. Let me try to explain in a simple
(aka least-mathematical I can think of) way:

For all these connectivity measures, we need the phase information from
the Fourier transform (FFT) to compute the cross-spectral density matrix
(CSD). The CSD can be regarded as the equivalent in the frequency domain
to the covariance matrix in the time domain, thus it is a measures how a
certain channels activity is co-modulated with another channels activity
(for a particular frequency) - makes pretty much sense to make use of
this when computing connectivity, right? :)
As you might know, a Fourier transform returns complex numbers, where
the imaginary part of this number contains phase information. When
calling ft_freqanalysis, you can decide if it shall only return the
(squared) real part of the frequency spectrum (cfg.output='pow'), or
instead the full CSD (cfg.output = 'powandcsd'). Alternatively, you can
also let ft_freqanalysis return the raw Fourier coefficients
(cfg.output='fourier'). From the Fourier coefficients, however, you can
easily obtain the CSD or the power spectrum basically by multiplication
the Fourier matrix with itself (transposed). All of these measures
quantify the phase relation between channels across trials, and as phase
information is coded in the imaginary part of the fourier output, thus
for connectivityanalysis you need the CSD which can be obtained either
by 'powandcsd' or by 'fourier'.

I hope that somehow clarifies your questions.

Best,
Jörn

On 5/17/2013 5:45 PM, Gabriel Gonzalez Escamilla wrote:
> Dear Fieltrip experts,
>
> I have my continuous data imported to fieldtrip with matlab, I'm
> looking for performing connectivity analysis between pairs of sensors,
> I have succed as:
> data.trials {1xNepochs}; % Nepochs = 7, each epoch with 59 channels
> and 2000 samples
> data.label {59x1};
> data.time {1xNepochs};
>
> then, calculate only the FFT of all sensors as:
> cfg=[];
> cfg.output='fourier';
> cfg.method='mtmfft';
> cfg.taper='hanning';
> cfg.foilim=[8.5 9.5];
> cfg.tapsmofrq=0;
> cfg.trials='all';
> cfg.keeptrials='yes';
> cfg.channel='all';
> fourier=ft_freqanalysis(cfg, data)
> as output I get:
> dimord = 'rpttap_chan_freq'
> freq= [1x9]
> fourierspctrm=[7x59x9 double]
>
> Then compute the imaginary part of coherency as:
> cfg=[];
> cfg.method ='cohe';
> cfg.complex='imag';
> cfg.channelcbm={'all' 'all'};
> coher = ft_connectivityanalysis (cfg, fourier)
> as output get:
> dimord='chan_chan_freq';
> cohspctrm=[59x59x9 double];
> dof=7;
>
> I have two main questions:
>
> A) As you see, this makes an average over the epochs of each channel,
> and not over the samples (which in this case are the 9 frequencies of
> the FFT), And I would like to have the opposite, this is, to get the
> imaginary part of coherence for each epoch (repetition) on all my
> channels and not for each frequency, something like: chan_chan_rpt or
> chancbm_rpt, Is this possible?
>
>
>
> B) Another question I have is: for the Imaginary part of Coherence is
> not necessary to compute the cross-spectrum with 'powandcsd', only the
> FFT, but for the PLV, PPC or WPLI is that way too?
>
>
>
>
> Gabriel.
>
>
>
> _______________________________________________
> 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
Neuronal Oscillations Group
FieldTrip Development Team

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

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

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/20130521/a7c25f21/attachment-0002.html>