<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Eva,
<div class=""><br class="">
</div>
<div class="">I don’t know the algorithmic details of the ‘reference’ approaches’, but:</div>
<div class=""><br class="">
</div>
<div class="">1) cfg.foi = [1 60] will give you only 2 frequency bins in the output of ft_freqanalysis (with method = ‘mvar’). The mvar method requires a vector of frequency bins.</div>
<div class="">2) 9 segments is really not a lot for a coherence estimate: In the limit of a single segment the coherence goes to 1</div>
<div class=""><br class="">
</div>
<div class="">I’d start with changing the cfg.foi into [0:60], (or omitting it altogether) and see what happens.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 11 Oct 2021, at 23:02, Eva Masson via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Hi FieldTrippers !</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I am currently implementing a script for computing coherence (and Granger causality, but that’s another topic) measure of iEEG data.</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I am aware of two different paths in doing so: the parametric and non parametric approaches. As I am still at the early stages of the method, I am using data that was already tested for coherence in another software as reference and performing the coherence-related
 steps in FieldTrip, based on the following tutorial :</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<a href="https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/tutorial/connectivity/__;!!HJOPV4FYYWzcc1jazlU!qleIR_V3gd0VSeD0kXBxAdiFSlnXmwyrdQCjLUq3kr7Q84KsrWkhIzKdJU_UtL22aaj_LXrrtwTxbCw$" style="color: blue; text-decoration: underline;" class="">https://www.fieldtriptoolbox.org/tutorial/connectivity/</a></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
To summarize, I want to compute the coherence between electrodes X and Y for each frequency from 0 to 60 Hz. The input data consists in 9 segments of 300ms each after preprocessing, fsample 256.0164 Hz.</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
The problem is in the coherence measure I compute. The output of the following script is an unexpectedly high coherence measure, sometimes up to 0.9 when there is supposedly no to little coherence as compared to the « reference » measure on the other software.
 However, after searching through the FieldTrip functions code, the way of measuring the coherence seems to be the same (using the cross and auto Spectrum).</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I am very most likely missing a step or a parameter in my script, but I have no clue what it is, where it is, and what I am misunderstanding.</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Please find here a simplified version of my code for the parametric way of computing coherence.</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">% Compute mvar<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">cfg = [];<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">cfg.order = 12; % here I have tried different model orders and the problem persists<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">cfg.toolbox = 'bsmart';<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">cfg.channel = {‘X’ ‘Y’};<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">mvar_data = ft_mvaranalysis(cfg, data);<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">% Passage fréquence<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">cfg = [];<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">cfg.method = 'mvar';<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">cfg.foi = [1 60];<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">mvar_freq = ft_freqanalysis(cfg, mvar_data);<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">% Optionnel : cohérence<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">cfg = [];<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">cfg.method = 'coh';<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-family: "Amasis MT Pro", serif;" class="">mvar_coh = ft_connectivityanalysis(cfg, mvar_freq);<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Do you know what is wrong with this ? I would be very thankful if you could help me on this <span style="font-family: "Segoe UI Emoji", sans-serif;" class="">😊</span></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Thanks a lot !</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Cheers !</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Eva</div>
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!qleIR_V3gd0VSeD0kXBxAdiFSlnXmwyrdQCjLUq3kr7Q84KsrWkhIzKdJU_UtL22aaj_LXrriM-uq7Q$" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!qleIR_V3gd0VSeD0kXBxAdiFSlnXmwyrdQCjLUq3kr7Q84KsrWkhIzKdJU_UtL22aaj_LXrriM-uq7Q$</a><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>