<div dir="ltr"><div><div>Hi again, Jan-Mathijs-<br><br></div>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:<br><br>virtualchannel01 = <br><br>    label: {'source1'}<br>     time: {1x66 cell}<br>    trial: {1x66 cell}<br><br>virtualchannel02 = <br><br>    label: {'source2'}<br>     time: {1x66 cell}<br>    trial: {1x66 cell}<br><br>% append virtual channel datasets<br>cfg = [];<br>cfg.continuous = 'no';<br>data_both = ft_appenddata(cfg, virtualchannel01, virtualchannel02);<br><br>% compute mvar analysis<br>cfg = [];<br>cfg.continuous = 'no';<br>cfg.toolbox = 'bsmart';<br>cfg.order = 5;<br>cfg.channelcmb = ['source1'; 'source2'];<br>mvardata = ft_mvaranalysis(cfg, data_both);<br><br></div><div><b>which outputs the following:</b><br></div><div><br></div><div>Warning: transposing channelcombination matrix <br>> In ft_channelcombination (line 60)<br>  In ft_mvaranalysis (line 204) <br><br>label = <br><br>    'source1'<br>    'source2'<br><br>the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 0 MB<br>preprocessing<br>preprocessing trial 66 from 66<br><br>the call to "ft_preprocessing" took 0 seconds and required the additional allocation of an estimated 0 MB<br>Index exceeds matrix dimensions.<br><br>Error in ft_mvaranalysis (line 333)<br>  tmpcfg.toilim = timeaxis([begsample endsample]);<br><br><div><br></div><div>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?<br><br></div><div>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.<br><br></div><div>Once again, thanks for all your help!!<br><br></div><div>Helen WIeffering<br></div><div>Erika Nyhus<br></div><div>Dept of Neuroscience<br></div><div>Bowdoin College<br></div><div><br><br><br><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 30, 2015 at 5:08 PM, Schoffelen, J.M. (Jan Mathijs) <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
Hi Helen,
<div><br>
</div>
<div>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.</div>
<div>Reason: for the parametric estimator, what’s in a name, you parametrize the spectrum, so you get all frequencies for ‘free’.</div>
<div>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).</div>
<div>Best,</div>
<div>Jan-Mathijs</div><div><div class="h5">
<div><br>
</div>
<div><br>
</div>
<div><br>
<div>
<div>On Jul 30, 2015, at 10:51 PM, Helen Wieffering <<a href="mailto:helen.wieffering@gmail.com" target="_blank">helen.wieffering@gmail.com</a>> wrote:</div>
<br>
<blockquote type="cite">
<div dir="ltr">Hi Jan-Mathis,
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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?</div>
<div><br>
</div>
<div>Thanks again!</div>
<div><br>
</div>
<div>Helen Wieffering</div>
<div>Erika Nyhus</div>
<div>Dept. of Neuroscience</div>
<div>Bowdoin College</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Jul 30, 2015 at 3:30 PM, Schoffelen, J.M. (Jan Mathijs)
<span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Helen,<br>
<br>
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.<br>
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:<br>
<br>
-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: <a href="http://onlinelibrary.wiley.com/doi/10.1002/hbm.21482/full.-alternatively" rel="noreferrer" target="_blank">
http://onlinelibrary.wiley.com/doi/10.1002/hbm.21482/full.<br>
-alternatively</a>, 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.<br>
<br>
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.<br>
<br>
Best wishes,<br>
<br>
Jan-Mathijs<br>
<br>
<br>
<br>
<br>
<br>
<br>
Jan-Mathijs Schoffelen, MD PhD, Senior researcher<br>
<br>
Max Planck Institute for Psycholinguistics<br>
Donders Centre for Cognitive Neuroimaging<br>
<br>
E-mail: <a href="mailto:j.schoffelen@donders.ru.nl" target="_blank">j.schoffelen@donders.ru.nl</a><br>
Telephone: <a href="tel:%2B31-24-3614793" value="+31243614793" target="_blank">+31-24-3614793</a><br>
<br>
<a href="http://www.hettaligebrein.nl/" rel="noreferrer" target="_blank">http://www.hettaligebrein.nl</a><br>
<a href="http://www.fieldtriptoolbox.org/" rel="noreferrer" target="_blank">http://www.fieldtriptoolbox.org</a><br>
<div>
<div><br>
<br>
On Jul 30, 2015, at 8:31 PM, Helen Wieffering <<a href="mailto:helen.wieffering@gmail.com" target="_blank">helen.wieffering@gmail.com</a>> wrote:<br>
<br>
> Dear FieldTrip users,<br>
><br>
> I am writing to ask for any available guidance on computing granger causality measures using ft_connectivity_analysis in FieldTrip.<br>
><br>
> Our data comes from 128 EEG channels. So far we have:<br>
> - cleaned and preprocessed the data<br>
> - computed frequency analysis using 'mtmfft' at 6 Hz<br>
> - localized sources of 6hz activity to a normalized head model using Beamformer and method 'dics'.<br>
><br>
> 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.<br>
><br>
> 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.<br>
><br>
> If anyone has had success with this, I'd love to hear!<br>
><br>
> Thanks in advance.<br>
><br>
> Helen Wieffering<br>
> Erika Nyhus<br>
> Dept. of Neuroscience<br>
> Bowdoin College<br>
</div>
</div>
> _______________________________________________<br>
> fieldtrip mailing list<br>
> <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<br>
<br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote>
</div>
<br>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>
</div>
<br>
</div>
<br>
<br>
<br>
</div></div></div>

<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>