[FieldTrip] Granger Causality Analysis after Beamformer

Helen Wieffering helen.wieffering at gmail.com
Thu Aug 6 16:50:55 CEST 2015

Hi again, Jan-Mathijs-

Thanks again for your help. I have been following your suggestion and so
far completed LCMV Beamformer on two regions of interest and gone on to
construct two virtual channels from there, according to the connectivity
tutorial. However, I receive an error when I compute ft_mvaranalysis and
would be grateful if you could take a look:

virtualchannel01 =

    label: {'source1'}
     time: {1x66 cell}
    trial: {1x66 cell}

virtualchannel02 =

    label: {'source2'}
     time: {1x66 cell}
    trial: {1x66 cell}

% append virtual channel datasets
cfg = [];
cfg.continuous = 'no';
data_both = ft_appenddata(cfg, virtualchannel01, virtualchannel02);

% compute mvar analysis
cfg = [];
cfg.continuous = 'no';
cfg.toolbox = 'bsmart';
cfg.order = 5;
cfg.channelcmb = ['source1'; 'source2'];
mvardata = ft_mvaranalysis(cfg, data_both);

*which outputs the following:*

Warning: transposing channelcombination matrix
> In ft_channelcombination (line 60)
  In ft_mvaranalysis (line 204)

label =


the call to "ft_selectdata" took 0 seconds and required the additional
allocation of an estimated 0 MB
preprocessing trial 66 from 66

the call to "ft_preprocessing" took 0 seconds and required the additional
allocation of an estimated 0 MB
Index exceeds matrix dimensions.

Error in ft_mvaranalysis (line 333)
  tmpcfg.toilim = timeaxis([begsample endsample]);

I'm wondering where this error comes from  - not sure how to go about
fixing it. My present goal has been to practice these steps and experiment
with connectivity analysis, and therefore the datasets I'm working with are
relatively small - is it possible that's the issue here?

Also, I wondered if FieldTrip (or the bsmart toolbox) offers any guidance
on how to select a mvar model order, as I know this is an influential
factor in Granger Causality. I've experimented with SIFT in the past and
found their model-fitting guidance and validation very helpful - don't know
if there's anything similar that's also compatible with FieldTrip.

Once again, thanks for all your help!!

Helen WIeffering
Erika Nyhus
Dept of Neuroscience
Bowdoin College

On Thu, Jul 30, 2015 at 5:08 PM, Schoffelen, J.M. (Jan Mathijs) <
jan.schoffelen at donders.ru.nl> wrote:

> Hi Helen,
> Yes, you can restrict yourself in the end to focus on a predefined
> frequency band. Yet, for the computation, you need to compute the whole
> frequency range.
> Reason: for the parametric estimator, what’s in a name, you parametrize
> the spectrum, so you get all frequencies for ‘free’.
> for the non-parametric estimator, you need to whole spectrum to begin
> with, in order to be able to decompose the cross-spectrum, using the
> Wilson-Burg algorithm (as described in the 2008 Dhamala paper).
> Best,
> Jan-Mathijs
> On Jul 30, 2015, at 10:51 PM, Helen Wieffering <helen.wieffering at gmail.com>
> wrote:
> Hi Jan-Mathis,
> Thanks for your quick reply - this is very helpful. In fact, we've already
> completed coherence measures on this data and pre-defined potential areas
> of interest based on published literature - but we wanted to take that
> further by looking into granger causality.
> I want to follow up on the first method you described (applying
> ft_mvaranalysis to source-level data). We would like to limit our
> connectivity analysis to the theta-band frequencies, which was why DICS
> Beamformer was appealing. However, if I'm understanding correctly, the LCMV
> filter is necessary for our connectivity analysis since granger causality
> is computed in the time domain. I'm wondering, if we go back and compute
> LCMV source reconstruction instead, will it be possible to later compute
> granger causality for the specific frequencies we're studying?
> Thanks again!
> Helen Wieffering
> Erika Nyhus
> Dept. of Neuroscience
> Bowdoin College
> On Thu, Jul 30, 2015 at 3:30 PM, Schoffelen, J.M. (Jan Mathijs) <
> jan.schoffelen at donders.ru.nl> wrote:
>> Dear Helen,
>> There is no step-by-step guidance for this on the FieldTrip wiki.
>> Personally, I would first go for a slightly less ambitious, i.e. not use
>> Granger causality as the target connectivity measure, but first investigate
>> the patterns in the data using plain good-old-fashioned (imaginary)
>> coherence or so, which is a measure that can be easily computed given the
>> pipeline you have executed so far.
>> The estimation of Granger causality (in the frequency domain), or of one
>> of its relatives such as PDC or DTF requires one of the following 2
>> approaches:
>> -indeed you either need to get your spectral transfer matrix by
>> parametric means, i.e. call ft_mvaranalysis (either on sensor-level or on
>> source-level data), and proceed from there. If the coefficients are to be
>> estimated on source-level data, you first need to apply a source
>> reconstruction in the time domain, e.g. using an LCMV-beamformer, create a
>> set of ‘virtual channels’ (there is some docu about this on the FT-wiki, I
>> guess you will get there with the search term ‘virtual channel’. Once you
>> are at the source level, you can either continue with ft_mvaranalysis on
>> the virtual channel time courses, followed by ft_freqanalysis_mvar,
>> followed by ft_connectivityanalysis, or you can follow the non-parametric
>> route, where you would do an ft_freqanalysis (with ‘mtmfft’), followed by
>> ft_connectivityanalysis. How this is done in practice is explained in one
>> of the tutorials that are concerned with connectivity (in the example it is
>> demonstrated with ‘channel’ data, but it would be straightforward to fool
>> FieldTrip into swallowing ‘virtual channel’ data). A different route along
>> the parametric-estimation path would be to fit the autoregressive model at
>> the channel-level (in a PCA-reduced subspace), and project the coefficients
>> of the model into source space. The idea behind this approach is explained
>> and demonstrated in this paper:
>> http://onlinelibrary.wiley.com/doi/10.1002/hbm.21482/full.
>> -alternatively
>> <http://onlinelibrary.wiley.com/doi/10.1002/hbm.21482/full.-alternatively>,
>> you can estimate spectra non-parametrically (with mtmfft), and then compute
>> a ‘broadband’ spatial filter with LCMV, using the covariance estimated from
>> the same data epochs as the ones you will use for the spectral
>> decomposition. Next, you can project the sensor level fourier-data into
>> source space using the spatial filters (use cfg.keepfilter = ‘yes’ when
>> calling ft_sourceanalysis) defined at your locations of interest. This is
>> allowed because the spatial filtering is a linear step, as is the Fourier
>> transformation, so the order of which shouldn’t matter for the result,
>> although the computation may be more efficient in one order or the other.
>> The difficult thing for you I guess would be a way to a priori define
>> your locations of interest. This is an empirical question, but you could
>> either use information from published literature, or preferably an
>> experimental contrast from your data to identify regions-of-interest.
>> Best wishes,
>> Jan-Mathijs
>> Jan-Mathijs Schoffelen, MD PhD, Senior researcher
>> Max Planck Institute for Psycholinguistics
>> Donders Centre for Cognitive Neuroimaging
>> E-mail: j.schoffelen at donders.ru.nl
>> Telephone: +31-24-3614793
>> http://www.hettaligebrein.nl
>> http://www.fieldtriptoolbox.org
>> On Jul 30, 2015, at 8:31 PM, Helen Wieffering <helen.wieffering at gmail.com>
>> wrote:
>> > Dear FieldTrip users,
>> >
>> > I am writing to ask for any available guidance on computing granger
>> causality measures using ft_connectivity_analysis in FieldTrip.
>> >
>> > Our data comes from 128 EEG channels. So far we have:
>> > - cleaned and preprocessed the data
>> > - computed frequency analysis using 'mtmfft' at 6 Hz
>> > - localized sources of 6hz activity to a normalized head model using
>> Beamformer and method 'dics'.
>> >
>> > We would now like to compute connectivity analysis between the
>> strongest sources, using granger causality. I have read through the
>> FieldTrip tutorials, but am still not sure how to proceed.
>> >
>> > Mainly, my question is whether we should have first computed
>> ft_mvaranalysis with our preprocessed data, and then done frequency
>> analysis using cfg.method = 'mvar' and proceeded with source analysis
>> (Beamformer) from there. Should we go back and complete those steps? I'm
>> also wondering about the best method for selecting sources to use for
>> connectivity analysis.
>> >
>> > If anyone has had success with this, I'd love to hear!
>> >
>> > Thanks in advance.
>> >
>> > Helen Wieffering
>> > Erika Nyhus
>> > Dept. of Neuroscience
>> > Bowdoin College
>> > _______________________________________________
>> > fieldtrip mailing list
>> > fieldtrip at donders.ru.nl
>> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150806/9f862bea/attachment-0001.html>

More information about the fieldtrip mailing list