<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Hi Daniel, <div>One solution is to segment your five trials into 1s or 2s epochs if they are long enough.  Re the negative values: if you used the debiased WPLI method just ignore the negative values; in contrast, if you used the WPLI method you may calculate the absoluate value of the WPLI values, i.e., abs(WPLI).  </div><div><br></div><div>Best,</div><div>Wanze</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl">jan.schoffelen@donders.ru.nl</a>> 于2019年6月13日周四 下午2:45写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">



<div style="word-wrap:break-word;line-break:after-white-space">
Hi Daniel,
<div><br>
</div>
<div>If you only have 5 trials in your input data, the estimate itself will be enormously biased, and possibly by consequence is the bias correction ‘overshooting’.</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Jan-Mathijs</div>
<div><br>
<div><br>
<blockquote type="cite">
<div>On 13 Jun 2019, at 19:10, <a href="mailto:daniel.strahnen@uni-ulm.de" target="_blank">
daniel.strahnen@uni-ulm.de</a> wrote:</div>
<br class="gmail-m_6641469036175833569Apple-interchange-newline">
<div>
<div class="gmail-m_6641469036175833569WordSection1" style="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;text-decoration:none">
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
Dear Fieldtrippers,<u></u><u></u></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">I am a doctoral student and my research fields are local field potentials (LFPs).<span class="gmail-m_6641469036175833569Apple-converted-space"> </span><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">Therefore I wanted to calculate the weighted phase lag index which is implemented in the Fieldtrip toolbox.<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">The data I want to analyse has the following structure:<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">data =<span class="gmail-m_6641469036175833569Apple-converted-space"> </span><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB"><u></u> <u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">  struct with fields:<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB"><u></u> <u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">      label: {7×1 cell}<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">       time: {1×5 cell}<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">      trial: {1×5 cell}<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">    fsample: 1000                  % Seven channels and five trials<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB"><u></u> <u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">The code I produced for the wPLI is the following:<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:forestgreen">%% Freqanalysis to obtain the cross spectral density</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_freq = [];</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_freq.method =<span class="gmail-m_6641469036175833569Apple-converted-space"> </span></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'mtmfft'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">;</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_freq.output =<span class="gmail-m_6641469036175833569Apple-converted-space"> </span></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'powandcsd'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">;</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_freq.channel = {</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'CH2'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><span class="gmail-m_6641469036175833569Apple-converted-space"> </span></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'CH4'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">};</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_freq.keeptrials =<span class="gmail-m_6641469036175833569Apple-converted-space"> </span></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'yes'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">;<span class="gmail-m_6641469036175833569Apple-converted-space"> </span></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:forestgreen">%
 do not return an average of all trials for subsequent wpli analysis</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_freq.taper =<span class="gmail-m_6641469036175833569Apple-converted-space"> </span></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'dpss'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">;</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_freq.tapsmofrq = 1;</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_freq.foilim = [0 48];</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">freq_data = ft_freqanalysis(cfg_freq, data);</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:forestgreen">%% WPLI analysis</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_conn = [];</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">cfg_conn.method =<span class="gmail-m_6641469036175833569Apple-converted-space"> </span></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'wpli_debiased'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">;</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">wpli = ft_connectivityanalysis(cfg_conn, freq_data);</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">wpli = ft_checkdata(wpli,<span class="gmail-m_6641469036175833569Apple-converted-space"> </span></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'cmbrepresentation'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">,<span class="gmail-m_6641469036175833569Apple-converted-space"> </span></span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'full'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">,</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'datatype'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">,</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'freq'</span><span lang="EN-GB" style="font-size:10pt;font-family:"Courier New"">);<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-size:10pt;font-family:"Courier New""><u></u> <u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB" style="font-family:"Courier New""><u></u> <u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">I now have two questions:<u></u><u></u></span></div>
<ol start="1" type="1" style="margin-bottom:0cm;margin-top:0cm">
<li class="gmail-m_6641469036175833569MsoListParagraph" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">Why are there negative results? I already saw this question in a previous discussion but I’m still not sure about the hundred percent correct answer.<u></u><u></u></span></li></ol>
<div style="margin:0cm 0cm 0.0001pt 36pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB"><u></u> <u></u></span></div>
<ol start="2" type="1" style="margin-bottom:0cm;margin-top:0cm">
<li class="gmail-m_6641469036175833569MsoListParagraph" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">The results I get look rather strange at the first glance because there are a lot of consecutive One-values which seems unrealistic to me.<br>
Do you think my analysis has a mistake or the data is corrupted?<u></u><u></u></span></li></ol>
<div style="margin:0cm 0cm 0.0001pt 36pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB"><u></u> <u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">Thank you very much for your help in advance and best regards<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB"><u></u> <u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<span lang="EN-GB">Daniel<u></u><u></u></span></div>
</div>
<span style="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;text-decoration:none;float:none;display:inline">_______________________________________________</span><br style="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;text-decoration:none">
<span style="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;text-decoration:none;float:none;display:inline">fieldtrip
 mailing list</span><br style="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;text-decoration:none">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color:rgb(149,79,114);text-decoration:underline;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" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="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;text-decoration:none">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" style="color:rgb(149,79,114);text-decoration:underline;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" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a></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>