<div dir="auto"><div>Dear Jan-Mathijs, </div><div dir="auto"><br></div><div dir="auto">Thank you for your reply.</div><div dir="auto"><br></div><div dir="auto">I am analysing resting state data so I don't have any "trials" as such, but that I would like to calculate PLI values for successive 2 sec segments in my data.</div><div dir="auto"><br></div><div dir="auto">What does cfg.keeptrials = 'yes' accomplish in this case? My idea was that since this calculates the cross-spectral density at the trial level, the subsequent PLI is also calculated at the trial level.</div><div dir="auto"><br></div><div dir="auto">Coming back to my initial question, how do I get the PLI across a certain frequency band (example: 8-13 hz, Alpha band) for each 2 sec segments? Currently with my script I am getting a PLI value with the dimensions : repetition * channel * channel * frequencies (in steps of 1 hz). </div><div dir="auto"><br></div><div dir="auto">Best,</div><div dir="auto">Avi<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Mon, Apr 4, 2022, 3:49 AM Schoffelen, J.M. (Jan Mathijs) via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word;line-break:after-white-space">
Hi Avi,
<div><br>
</div>
<div>PLI, like any other connectivity metric needs to be computed across some unit-of-observation in order for it to make sense.</div>
<div>In FieldTrip, the  UOs for connectivity analysis are always considered to be the trial dimension.</div>
<div><br>
</div>
<div>In other words, no there is no way to compute a PLI for an individual trial (although you could get a ‘proxy’ for the single trial PLI by computing a so-called pseudo value, which from the top of my head (but please look this up to be sure) is
 computed as: N*PLI(all) - (N-1)*PLI(loo), where PLI(avg) is the PLI computed across all repetitions, and PLI(loo) is the PLI computed using a leave-one-out strategy. You may also have a look at this paper: <a href="https://pubmed.ncbi.nlm.nih.gov/25917516/" target="_blank" rel="noreferrer">https://pubmed.ncbi.nlm.nih.gov/25917516/</a> or
 this one: <a href="https://pubmed.ncbi.nlm.nih.gov/17569862/" target="_blank" rel="noreferrer">https://pubmed.ncbi.nlm.nih.gov/17569862/</a> </div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Jan-Mathijs</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<div><br>
<blockquote type="cite">
<div>On 3 Apr 2022, at 06:42, Avijit Chowdhury via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" target="_blank" rel="noreferrer">fieldtrip@science.ru.nl</a>> wrote:</div>
<br>
<div>
<div 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:0in;font-size:11pt;font-family:Calibri,sans-serif">
Dear all,<u></u><u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
I am novice to EEG analysis and I am trying to calculate Phase Lag Index for my resting state data.<u></u><u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
I have redefined the data as 2 sec trials and then run ft_frequencyanalysis with “powandcsd” as cfg.output:<u></u><u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg = [];<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg.length = 2;<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">data_trials = ft_redefinetrial(cfg, data);<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas"><u></u> <u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg              = [];<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg.method =<span> </span><span style="color:rgb(170,4,249)">'mtmfft'</span>;<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg.taper =<span> </span><span style="color:rgb(170,4,249)">'hanning'</span>;<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg.foilim = [8 13]; % I want to look only at alpha band<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg.keeptrials =<span> </span><span style="color:rgb(170,4,249)">'yes'</span>;<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg.pad=<span style="color:rgb(170,4,249)">'nextpow2'<span> </span></span>;<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg.output=<span style="color:rgb(170,4,249)">'powandcsd'</span>;<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas;color:rgb(2,128,9)"></span><span style="font-size:10pt;font-family:Consolas">freq = ft_freqanalysis(cfg, data_trials);<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas"><u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas"> cfg = [];<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">cfg.method    =<span> </span><span style="color:rgb(170,4,249)">'wpli'</span>;<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:10pt;font-family:Consolas">PLI= ft_connectivityanalysis(cfg, freq);<u></u><u></u></span></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
With the above script, I get an output of PLI with the dimension of trials x channel x channel x frequency.<span> </span><u></u><u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
Is there a way I can get one PLI index for each trial, for each channel combination, across the frequency band I specified. Essentially, how can I get PLI values with dimensions: trials x channel x channel<u></u><u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
I am very new to this so any help is appreciated. Also, If I am trying to filter my results to only the alpha band (8-13hz), is what I am doing the correct way to achieve this?<u></u><u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
Thank you,<u></u><u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
Avi<u></u><u></u></div>
<div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">
<u></u> <u></u></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!important">_______________________________________________</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!important">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="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" rel="noreferrer">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://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7TVstS0axYC9hbjX14iENjBzGIjpNqefPnrn2XxYxqKa4UsNFATM6-cKN7mQKqX0uNMNNtAV18Iv9Pb9c00vvjVhVcpjr6GrhSaxeg$" 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" target="_blank" rel="noreferrer">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7TVstS0axYC9hbjX14iENjBzGIjpNqefPnrn2XxYxqKa4UsNFATM6-cKN7mQKqX0uNMNNtAV18Iv9Pb9c00vvjVhVcpjr6GrhSaxeg$</a><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!important"></span></div>
</blockquote>
</div>
<br>
</div>
</div>

_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer 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 noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div></div></div>