# Connectivity calculation using PLI

**URL:** <https://mne.discourse.group/t/connectivity-calculation-using-pli/2101>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [March 4, 2020, 10:34am UTC](https://mne.discourse.group/t/connectivity-calculation-using-pli/2101 "2020-03-04T10:34:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 4, 2020, 10:34am UTC](https://mne.discourse.group/t/connectivity-calculation-using-pli/2101/1 "2020-03-04T10:34:38Z")

</div>

External Email - Use Caution

Hi,

I want to compute connectivity between sources using the PLI metric.  
As far as I understand it, PLI is computed at the electrode level and  
not at the source level. Does anyone know how to transform the  
connectivity matrix between channels into a connectivity matrix  
between sources? (I've looked at the inverse operator but I have no  
idea how to apply it to the connectivity matrix).

Thanks,

Fleur  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20200304/ae6b14dc/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200304/ae6b14dc/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 4, 2020, 8:08pm UTC](https://mne.discourse.group/t/connectivity-calculation-using-pli/2101/2 "2020-03-04T20:08:09Z")

</div>

External Email - Use Caution

hi Fleur,

you cannot really transfer PLI from sensor to source. You need to estimate  
PLI directly in source space eg using parcels.

here an example

[https://mne.tools/stable/auto\_examples/connectivity/plot\_mne\_inverse\_label\_connectivity.html#sphx-glr-auto-examples-connectivity-plot-mne-inverse-label-connectivity-py](https://mne.tools/stable/auto_examples/connectivity/plot_mne_inverse_label_connectivity.html#sphx-glr-auto-examples-connectivity-plot-mne-inverse-label-connectivity-py)

or

[https://mne.tools/stable/auto\_examples/connectivity/plot\_mne\_inverse\_psi\_visual.html#sphx-glr-auto-examples-connectivity-plot-mne-inverse-psi-visual-py](https://mne.tools/stable/auto_examples/connectivity/plot_mne_inverse_psi_visual.html#sphx-glr-auto-examples-connectivity-plot-mne-inverse-psi-visual-py)

note that the choice of the parcellation and metric has been the topic  
of many papers  
with various recommendations.

HTH  
Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 6, 2020, 10:29am UTC](https://mne.discourse.group/t/connectivity-calculation-using-pli/2101/3 "2020-03-06T10:29:28Z")

</div>

External Email - Use Caution

Hello,

Thanks a lot for your help!

I actually want to z score connectivities for each subject. Is there a way to compute connectivity for each epoch in the source space? (I mean: a more efficient way than iterating over all epochs)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 6, 2020, 4:09pm UTC](https://mne.discourse.group/t/connectivity-calculation-using-pli/2101/4 "2020-03-06T16:09:23Z")

</div>

External Email - Use Caution

Hi Fleur,

our spectral connectivity code does not implement single-trial  
connectivity, it implements phase statistics across trials.  
If you want source-level connectivity, you need epochs in source space.  
To do that in a memory-efficient manner, you can use  
`return_generator=True` in  
[https://mne.tools/dev/generated/mne.minimum\_norm.apply\_inverse\_epochs.html](https://mne.tools/dev/generated/mne.minimum_norm.apply_inverse_epochs.html)  
and then for loop by source localizing one epoch at a time.

Best,  
Denis

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 9, 2020, 11:24am UTC](https://mne.discourse.group/t/connectivity-calculation-using-pli/2101/5 "2020-03-09T11:24:27Z")

</div>

External Email - Use Caution

Hello,

I tried source localizing one epoch at a time, and then computing connectivity for each epoch.

However, when I average the connectivity matrices over epochs, I do not obtain the same matrix as the one obtained by computing directly connectivity over all epochs in source space. Connectivity matrices for one epoch are made only of 0 and 1.

Is there something I'm missing ?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 10, 2020, 11:29pm UTC](https://mne.discourse.group/t/connectivity-calculation-using-pli/2101/6 "2020-03-10T23:29:09Z")

</div>

External Email - Use Caution

Hi Fleur,

The code in spectral connectivity does not yield any meaningful  
single-epoch results.  
At this point, the only valid usage of the function is to compute  
connectivity across trials.

Denis
