[FieldTrip] problem in connectivityanalysis
Gabriel Gonzalez Escamilla
ggonesc at upo.es
Tue May 21 17:52:21 CEST 2013
Thank you so much for your answer Jörn,
Now I got it, so, I will let the 'fourier' as input to ft_connectivityanalysis, because for some indices I will need the auto-spectrum, and if I fully undertood what you said, it will be the same, as they always take the phase information from the fourier transform. And fieltrip will automatically compute the csd if the input is the frequency data.
Nevertheless, it give me some error when I tried to use the output from 'powandcsd' of freqanalysis, always gives me a matrix dimensions error, and when I use the output 'fourier' from connectivityanalysis, it computes almost all indices to ok, raging from -1 to 1 (I'm saw that they are signed, so this is ok), the problem are the ImC ranging from -inf to inf, and the PLV values ranging from 0 to inf, but when I use the 'fourier' the values are. Which for me is really weird.
I have checked internally, and even when I always use the 'fourier' as input, when it internally calculates cross-spectrum for the ImC and PLV, the data.crsspctrm is different, e.g:
data.dimord = 'rpt_rpt_chan_chan_freq'
ans size(data.crsspctrm) = [1 7 59 59];
So, both are apparently the same, but the data inside this matrices is different,
for example, when calculating the ImC the first 7 columns for the first two rows are:
val(:,:,1,1)
[0.9323 0.3679 0.8629 1.6436 0.6404 1.8782 0.1139]
val(:,:,1,2)
[0.8509-0.1555i 0.2507-0.1066i 0.8173-0.0290i 1.4328-0.2427i 0.5457-0.0500i 1.6505-0.0161i 0.0993+0.0016i]
while when calculating the PLV are:
val(:,:,1,1)
[1 1 1 1 1 1 1]
val(:,:,1,2)
[0.9694-0.2133i 0.7011-0.3564i 0.9951-0.0104i 0.9014-0.3481i 0.9781-0.0819i 0.9982-0.0046i 0.9507-0.0483i]
I'm pretty sure I'm doing something wrong here, but I don't really have a clue,
If I use the fourier transform to calculate the 'csd' in ft_connectivity analysis and use this csd as input to all other ft_connectivityanalysis indices all of them are set to NaN or 1, not ranging between any numbers.
On the other hand, I have seen searching on the net, that fieltrip is capable of create surrogate data, by shifting the phase information on every trial for only one electrode of each pair while using the original samples of each trials on the second channel, but I couldn't find on the manual how to do such a thing. Is there any way to compute this kind of surrogates for every sensor? or was it something that some one suggest to somebody?
Many thanks in advanced,
Gabriel.
----- Mensaje original -----
De: "Jörn M. Horschig" <jm.horschig at donders.ru.nl>
Fecha: Martes, 21 de Mayo de 2013, 9:03 am
Asunto: Re: [FieldTrip] problem in connectivityanalysis
A: FieldTrip discussion list <fieldtrip at science.ru.nl>
> 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?
>
>
>
>
> Many thanks in advanced,
> 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 > Radboud University Nijmegen > 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 > > Visiting address: > Trigon, room 2.30 > Kapittelweg 29 > NL-6525 EN Nijmegen > The Netherlands > _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
<font size="3">--------------------------<br />PhD. student Gabriel González-Escamilla<br />Laboratory of Functional Neuroscience<br />Department of Physiology, Anatomy, and Cell Biology<br />University Pablo de Olavide<br />Ctra. de Utrera, Km.1<br />41013 - Seville<br />- Spain -<br /><br />Email: ggonesc at upo.es<br />http://www.upo.es/neuroaging/es/</font>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130521/0886ac06/attachment-0002.html>
More information about the fieldtrip
mailing list