<div dir="ltr"><p>Dear Jan-Mathijs,</p><p>Thank you very much for your detailed response to my previous query. I apologize for the delay in getting back to you as I have been supplementing my understanding of Granger causality in this field.</p><p>After further study, I found that my task-related data is non-stationary, as determined by the Augmented Dickey-Fuller unit-root test and the KPSS unit-root test. I have come across literature suggesting that using wavelet transform to compute the cross-power spectrum at each time-frequency point, followed by non-parametric Granger causality analysis, is suitable for non-stationary data (Dhamala, M., Rangarajan, G., & Ding, M. (2008)). Based on this, and after reviewing past community emails, I decided to use the following code for my task-related data non-parametric Granger causality analysis:</p><p>cfg = [];<br>cfg.channel = 'all';<br>cfg.method = 'tfr';<br>cfg.output = 'powandcsd';<br>cfg.foi = 3:1:250; %alternative method: cfg.foi = 0.02:1:250; <br>cfg.toi = [-0.6:0.02:-0.4,0:0.02:2.7]; % epoch time range [-1 3]<br>cfg.width = 3;<br>cfg.pad = 'nextpow2';<br>subj_data_tf = ft_freqanalysis(cfg, ft_data);<br>subj_data_tf.freq= round(subj_data_tf.freq);<br><br>grangercfg = [];<br>grangercfg.method = 'granger';<br>grangercfg.granger.conditional = 'no';<br>grangercfg.granger.sfmethod = 'bivariate';<br>gdata = ft_connectivityanalysis(grangercfg, subj_data_tf);</p><p>However, I learned from your previous response that the frequency axis should start from 0 and consist of integer elements. Given my sampling rate is 500 Hz, ideally, my frequency axis should be set to <code>0:1:250</code> because I need to integrate over the frequency axis to obtain time-domain Granger causality. I found that <code>cfg.method = 'tfr'</code> does not support setting the lowest frequency to 0 Hz. I attempted to set the frequency axis to <code>0.02:1:250.02</code> and used <code>subj_data_tf.freq = round(subj_data_tf.freq)</code> after wavelet transformation to approximate the ideal <code>0:1:250</code> frequency axis.</p><p>This rough approximation required zero-padding the epoch at both ends to estimate the cross-power spectrum at the boundary time-frequency points. However, I discovered that zero-padding at the epoch ends affects the estimates for all time-frequency points within the epoch, regardless of their proximity to the boundaries. Therefore, I am uncertain whether this approach is valid, and this forms my first question.</p><p>My second question pertains to the frequency axis configuration. I understand that if I set the frequency axis to <code>cfg.foi = 3:1:250</code>, the <code>ft_connectivityanalysis</code> function will automatically pad the frequency axis to <code>0:1:250</code> and add zero matrices for the cross-power spectra at 0 Hz, 1 Hz, and 2 Hz. Which method is more accurate: this automatic padding method or the method involving zero-padding the epoch data and setting the frequency axis to <code>0.02:1:250.02</code> for wavelet transformation?</p><p>Thank you once again for your time and assistance.</p><p>Best regards,</p><p>Chengyuan Wu</p></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Schoffelen, J.M. (Jan Mathijs) via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>> 于2024年6月15日周六 02:28写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
Hi Jeff,
<div><br>
</div>
<div>I agree that the documentation regarding several ways to compute transfer-function derived connectivity metrics is a bit sparse. <br id="m_-1522657314641806168lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On 13 Jun 2024, at 15:30, Jeff via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<p>To whom it may concern,</p>
<p>I hope this message finds you well. I am writing to seek assistance regarding the computation of frequency-domain Granger causality using non-parametric methods as described in the FieldTrip tutorial documentation. Specifically, I am interested in the section
on conditional Granger causality (<a rel="noreferrer" href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Fexample%2Fconnectivity_conditional_granger%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cdfcfff4cecf443e0b05808dc8c9bbe5e%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638539847739380313%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=001av91qmwyS7Xfgokx2rno7%2FIG8H0EwfPjEgWu3Wmg%3D&reserved=0" target="_blank">https://www.fieldtriptoolbox.org/example/connectivity_conditional_granger/</a>).</p>
<p>In the tutorial, the code explicitly specifies whether to use a bivariate or multivariate model, whereas other sections of the documentation (e.g.,
<a rel="noreferrer" href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Ftutorial%2Fconnectivityextended%2F%23introduction&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cdfcfff4cecf443e0b05808dc8c9bbe5e%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638539847739380313%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=wIJqzH6RAekNXNhpvtSnGR5X8B0yrAYCECpQ2T09I9Q%3D&reserved=0" target="_blank">
https://www.fieldtriptoolbox.org/tutorial/connectivityextended/#introduction</a>) do not explicitly state this. My question is: when the model type (bivariate or multivariate) is not explicitly stated, which model does FieldTrip use by default?</p>
</div>
</div>
</blockquote>
<div>If you seek to do non-parametric spectral factorization on a data structure with N-channels -> multivariate, because the default of cfg.sfmethod = ‘multivariate'</div>
<div>If you seek to do parametric estimation (where the data goes through ft_mvaranalysis, which by default does a multivariate AR model) -> also multivariate</div>
<div><br>
</div>
<blockquote type="cite">
<div>
<div dir="ltr">
<p>To investigate this, I conducted a small test. I found that specifying "cfg.granger.sfmethod = 'bivariate';" produced different directed connectivity results etween electrode pairs compared to when "cfg.granger.sfmethod" was not specified. This test was
conducted using the non-parametric Granger method. However, when using the parametric method as the tutorial, I found that specifying "cfg.granger.sfmethod = 'bivariate';" in "ft_connectivityanalysis" resulted in an error.</p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>This is because sfmethod parameter’s value refers to how the spectral factorization is to be performed. This is essentially non-parametric, so the combination and cfg don’t make sense in your particular test case.</div>
<div><br>
</div>
<div>A ‘bivariate’ decomposition of the spectral matrix, or equivalently a bivariate AR-model (i.e. estimated per pair of channels, if ft_mvaranalysis is supplied with a cfg.channelcmb field) will yield a different result for the estimated connectivity between
channels A and B, as compared to a situation where the spectral matrix decomposition was done, with - say - a channel C present (or equivalently, when the AR-model is estimated in a multivariate sense). I think that there are ample explanations about this
in the literature, but the gist of it is that any latent sources (e.g. source C not modelled along in the bivariate case) will influence the actual estimate between A and B. </div>
<div><br>
</div>
<div>On the other hand, the higher the dimensionality of the decomposition challenge at hand (i.e. # of channels, often poorly unmixed) the less informative the spectral transfer functions / AR-model coefficients (or often the model does not converge meaningfully
at all).</div>
<div><br>
</div>
Best wishes,</div>
<div>Jan-Mathijs</div>
<div><br>
<blockquote type="cite">
<div>
<div dir="ltr">
<p>Here is the code for my non-parametric Granger causality test:</p>
<p>cfg.toilim = [0.5 1.5]; <br>
data = ft_redefinetrial(cfg, data);<br>
<br>
cfg = [];<br>
cfg.method ='mtmfft';<br>
cfg.taper = 'dpss';<br>
cfg.output = 'fourier';<br>
cfg.tapsmofrq = 2;<br>
mfreq = ft_freqanalysis(cfg, data);<br>
<br>
cfg = [];<br>
cfg.method = 'granger';<br>
cfg.granger.conditional = 'no';<br>
cfg.granger.sfmethod = 'bivariate';<br>
mgranger_bivar = ft_connectivityanalysis(cfg, mfreq);<br>
<br>
cfg = [];<br>
cfg.method = 'granger';<br>
mgranger_default = ft_connectivityanalysis(cfg, mfreq);<br>
</p>
<p><br>
</p>
<p>Additionally, here is the code using the parametric Granger method, which does not allow explicit specification of "cfg.granger.sfmethod = 'bivariate';": <br>
</p>
<p>cfg = [];<br>
cfg.order = 5;<br>
cfg.toolbox = 'bsmart';<br>
mdata = ft_mvaranalysis(cfg, data);<br>
<br>
cfg = [];<br>
cfg.method = 'mvar';<br>
mfreq_para = ft_freqanalysis(cfg, mdata);<br>
<br>
cfg = [];<br>
cfg.method = 'granger';<br>
% cfg.granger.conditional = 'no'; %error<br>
% cfg.granger.sfmethod = 'bivariate';%error<br>
granger_para = ft_connectivityanalysis(cfg, mfreq_para);<br>
</p>
<p>I would greatly appreciate any guidance or recommendations on how to address this issue and understand the default model used by FieldTrip when not explicitly specified. My core question is whether the traditional bivariate model is used by default when
the model type (bivariate or multivariate) is not specified, regardless of whether a parametric or non-parametric Granger method is employed. If the default is indeed the bivariate model, why do the results differ from those obtained when explicitly specifying
the model as bivariate(with non-parametric Granger method)? Additionally, any insights on resolving the error encountered when specifying the bivariate model in the parametric method would be extremely helpful. <br>
</p>
<p>Thank you very much for your time and assistance.</p>
<p>Best regards, </p>
<p>Chengyuan Wu <br>
</p>
<p><br>
</p>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div>