<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Amasis MT Pro";
        panose-1:2 4 5 4 5 0 5 2 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="FR" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi FieldTrippers !</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am currently implementing a script for computing coherence (and Granger causality, but that’s another topic) measure of iEEG data.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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 :</p>
<p class="MsoNormal"><a href="https://www.fieldtriptoolbox.org/tutorial/connectivity/">https://www.fieldtriptoolbox.org/tutorial/connectivity/</a></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.</p>
<p class="MsoNormal">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).</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Please find here a simplified version of my code for the parametric way of computing coherence.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">% Compute mvar<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">cfg = [];<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">cfg.order = 12; % here I have tried different model orders and the problem persists<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">cfg.toolbox = 'bsmart';<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">cfg.channel = {‘X’ ‘Y’};<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">mvar_data = ft_mvaranalysis(cfg, data);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">% Passage fréquence<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">cfg = [];<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">cfg.method = 'mvar';<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">cfg.foi = [1 60];<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">mvar_freq = ft_freqanalysis(cfg, mvar_data);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">% Optionnel : cohérence<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">cfg = [];<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">cfg.method = 'coh';<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Amasis MT Pro",serif">mvar_coh = ft_connectivityanalysis(cfg, mvar_freq);<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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">😊</span></p>
<p class="MsoNormal">Thanks a lot !</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Cheers !</p>
<p class="MsoNormal">Eva</p>
</div>
</body>
</html>