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

Eva Masson eva.masson at hotmail.fr
Wed Jun 23 10:56:35 CEST 2021

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 !


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

More information about the fieldtrip mailing list