[FieldTrip] RE : Spectrally resolved Granger causality with ft_connectivity_granger

Eva Masson eva.masson at hotmail.fr
Tue Jun 22 11:57:32 CEST 2021

Hi Jan-Mathijs,

Thanks a lot ! It works, as I get the kind of structure I wanted.

This also made me realize I did not use ft_mvaranalysis properly, as I don’t get mvar coefficients over time but a repetition of the same coefficients for the n time points. As you said this approach is not ‘good’ for spectrally resolved Granger causality, I will look into the non parametric approach a little bit more.

Thanks again, and best wishes !

De : Schoffelen, J.M. (Jan Mathijs) via fieldtrip<mailto:fieldtrip at science.ru.nl>
Envoyé le :mardi 22 juin 2021 09:20
À : FieldTrip discussion list<mailto:fieldtrip at science.ru.nl>
Cc : Schoffelen, J.M. (Jan Mathijs)<mailto:janmathijs.schoffelen at donders.ru.nl>
Objet :Re: [FieldTrip] Spectrally resolved Granger causality with ft_connectivity_granger

Hi Eva,

Apologies, here’s an afterthought: the documentation of the function mentions that the first dimension of the input should be the ‘rpt’ dimension, so I suspect you’d need to shiftdim your input arguments with a ‘-1’.
Normally, you’d access ft_connectivity_granger through the higher level function ft_connectivityanalysis, which would take care of this step under-the-hood.

Concretely, probably it works if you do

H = shiftdim(freq.transfer,-1);
S = shiftdim(freq.crsspctrm,-1);
Z = shiftdim(freq.noisecov,-1);

g = ft_connectivity_granger(H,Z,S,’dimord’,’rpt_chan_chan_freq_time’);

Best wishes,

On 21 Jun 2021, at 22:28, Eva Masson via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hi FieldTrip Community !

I am trying to compute spectrally resolved Granger causality on (i)EEG data using the parametric approach, with mvar modelling. At this level, it is easier for my data than non parametric modelling.

From the original data, I have selected two channels to compute Granger causality from channel 1 to channel 2 and from channel 2 to channel 1.

I am currently struggling with the last step, from which I am expecting an output in the form of a 4-D structure containing the Granger causality power for each selected frequency and each time point for :

  *   Channel 1 to channel 1 (not very informative)
  *   Channel 1 to channel 2
  *   Channel 2 to channel 1
  *   Channel 2 to channel 2 (not very informative)

To do so, I am using the function ft_connectivity_granger, which I think is suited for spectrally resolved Granger causality, also while keeping the time dimension.

Here is my sloppy code :

[mvar_granger, V, n] = ft_connectivity_granger(mvar_freq.transfer, mvar_freq.noisecov, ...
    mvar_freq.crsspctrm, 'dimord', 'chan_chan_freq_time');

In which mvar_freq is the structure obtained after ft_mvaranalysis and transformed into the frequency domain with ft_freqanalysis_mvar. To be honest, I don’t know what V stands for in the output.

Here are the dimords of the mvar_freq fields used as inputs:
Transfer (H) and crsspctrm (S): chan_chan_freq_time
Noisecov (Z) : chan_chan_freq

After running the previous line, I do not get an error, but a mvar_granger structure in 3D containing a lot of 0 values. Honestly, I don’t really understand what it represents.

If someone knows how to work with ft_connectivity_granger in such a way that I can get the kind of output I am looking for (probably something like chan_chan_freq_time, right ?), I am all ears to your wisdom !

I would be very thankful for any help on this topic 😊

Cheers !

PS : Thanks a lot for this FieldTrip mailing list. I am learning so much thanks to it !
fieldtrip mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210622/e85fbb49/attachment.htm>

More information about the fieldtrip mailing list