[FieldTrip] RE : Time-frequency map of Granger causality from Fourier spectrum

Eva Masson eva.masson at hotmail.fr
Wed Jun 23 22:28:06 CEST 2021

Hi Jan-Mathijs,

Thanks for your help. As you recommended, I used mtmfft on segmented data and later reconstructed the time axis of a spectral Granger map with those segments. I am now trying to find the most adequate resolution/time window pairs for my iEEG data.

In any case I am planning to explore all the possibilities around computation of Granger causality. I might have other questions in the future 😊

Thanks again for your time !

De : Schoffelen, J.M. (Jan Mathijs) via fieldtrip<mailto:fieldtrip at science.ru.nl>
Envoyé le :mercredi 23 juin 2021 11:59
À : 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] Time-frequency map of Granger causality from Fourier spectrum

Hi Eva,

Allow me to point you to the discussion list’s archive. Specifically:




might be of relevance. In particular reason ‘2’, and Hints 1-3 in the 2019-July thread.

I suggest to start from there. Don’t hesitate to ask questions if you keep being stuck.

Best wishes,


On 23 Jun 2021, at 10:56, Eva Masson via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hi FieldTrip Community !

I need your wisdom !

I am trying to compute a time-frequency map of Granger causality for EEG data using a non parametric approach. To do so, I computed the Fourier Spectrum using the ‘mtmconvol’ method of ft_freqanalysis and I am now trying to feed it into ft_connectivityanalysis using the ‘granger’ method. I get an error that I don’t understand.

Here is the freq structure I’m trying to force into ft_connectivityanalysis :

freq =
            label: {2x1 cell}
           dimord: 'rpttap_chan_freq_time'
             freq: [1x64 double]
             time: [1x31 double]
    fourierspctrm: [4-D double]
        cumtapcnt: [1x64 double]
              cfg: [1x1 struct]

How I use ft_connectivityanalysis :

cfg = [];
cfg.method = 'granger';

granger = ft_connectivityanalysis(cfg, freq);

And the error message Matlab displays :

Error using zeros
Size inputs must be integers.

Error in sfactorization_wilson (line 63)
  S        = cat(3, zeros(size(S,1), size(S,1), npad), S);

Error in ft_connectivity_csd2transfer (line 181)
      [Htmp, Ztmp, Stmp] = sfactorization_wilson(tmp, freq.freq, ...

Error in ft_connectivityanalysis (line 430)
        data   = ft_connectivity_csd2transfer(data, optarg{:});

Can you enlighten me on this issue ?
Thanks a lot for your help !


fieldtrip mailing list

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

More information about the fieldtrip mailing list