Initialize NeuroAnalyzer
using NeuroAnalyzer
eeg = load("files/eeg.hdf")
e10 = epoch(eeg; ep_len = 10)using NeuroAnalyzer
eeg = load("files/eeg.hdf")
e10 = epoch(eeg; ep_len = 10)Phase Lag Index (PLI) measures asymmetry in phase differences between signals, focusing on non-zero phase lags.
Phase Locking Value (PLV): measures consistency of phase differences, regardless of lag.
Key Differences:
| Feature | PLV | PLI |
|---|---|---|
| Primary goal | Measures the stability of the phase difference between two signals | Measures the consistency of the sign of the phase difference |
| Sensitivity | All phase differences | Only non-zero phase lags |
| Volume Conduction | Affected by zero-lag artifacts | Less affected |
| Range | 0 to 1 | 0 to 1 |
| Sensitivity to noise | Less sensitive to noise | More sensitive to noise perturbations |
| Use Case | General phase synchronization | True interaction detection |
Use PLI if you want to minimize the effect of volume conduction and focus on true interactions between sources.
Use PLV if you want to detect any phase synchronization, regardless of lag.
Phase Lag Index (PLI) measures asymmetry in phase differences between two signals, ignoring zero-lag synchronization (which may be due to volume conduction).
Formula:
\[ \text{PLI} = \left \vert \frac{1}{N} \sum_{k=1}^N \text{sign}(\Delta \phi_{ij} (t_n)) \right \vert \]
where: \(\text{sign}(\sin(\Delta\phi))\) returns 1 if the phase difference is positive, -1 if negative.
Range: 0 (no lag) to 1 (consistent non-zero lag).
Use Case: Ideal for identifying true interactions in EEG/MEG data.
Interpretation:
Advantages:
Calculating PLI:
pli_data = pli(e10,
e10;
ch1 = "F3",
ch2 = "F4",
ep1 = 1,
ep2 = 1)
println("PLI: $(pli_data.pv[1])")PLI: 0.04453125
Weighted Phase Locking Index (WPLI) is a weighted version of PLI that accounts for the magnitude of phase differences (Nolte et al. 2004).
Formula:
\[ \text{WPLI} = \frac{\left \vert \sum_{n=1}^{N} w_n e^{i \Delta \phi_{ij}(t_n)} \right \vert}{\sum_{n=1}^{N} \vert w_n \vert} \]
where: \(w_n = \text{Im}(e^{i \Delta \phi_{ij}(t_n)})\) (the imaginary part of the complex phase difference).
Alternatively, WPLI can be calculated using Cross Power Spectrum Density (CPSD):
\[ \text{WPLI}(f) = \frac{\left \vert \left \langle \text{Im}(S_{xy}(f)) \right\rangle \right \vert}{\left \langle \vert S_{xy}(f) \vert \right\rangle} \]
where:
- \(\text{Im}(S_{xy}(f))\) is the imaginary part of the CPSD,
- \(\left \vert \cdot \right \vert\) denotes the magnitude.
Range: 0 (no phase locking) to 1 (perfect phase locking).
Advantage:
Why Use WPLI?
Use Cases
The wPLI weights each phase difference by the magnitude of the imaginary component of the cross-spectrum, which helps to downplay the contribution of phase differences around \(0\) or \(\pi\) (which are more likely to be due to volume conduction).
Calculating wPLI:
wpli_data = wpli(e10,
e10;
ch1 = "F3",
ch2 = "F4",
ep1 = 1,
ep2 = 1)
println("wPLI: $(wpli_data.pv[1])")wPLI: 2.0229218207816276e-17
Additionally, a debiased wPLI estimator can be calculated:
wpli_data = wpli(e10,
e10;
ch1 = "F3",
ch2 = "F4",
ep1 = 1,
ep2 = 1,
debiased = true)
println("WPLI: $(wpli_data.pv[1])")WPLI: -0.006158630306069087
Directed Phase Lag Index (dPLI) was introduced in by Stam et al. (2012) to capture the phase and lag relationship as a measure of directed functional connectivity.
dPLI is defined as the probability that the instantaneous phase of \(x\) was smaller than the phase of \(y\) (modulo \(\pi\)).
dpli_data = dpli(e10,
e10;
ch1 = "F3",
ch2 = "F4",
ep1 = 1,
ep2 = 1)
println("dPLI: $(dpli_data.pv[1])")dPLI: 0.417578125
Null connectivity is 0 for PLI and wPLI, but 0.5 for dPLI.
wPLI is less sensitive to noise and is the method of choice for studying an underlying phase relationship.
To study directionality, use wPLI or dPLI.
Phase Locking Value (PLV) measures consistency of phase differences, including zero and non-zero lags.
Formula:
\[ PLV = \frac{1}{N} \left \vert \sum_{n=1}^{N} e^{i \Delta \phi_{ij}(t_n)} \right \vert \]
Range: 0 (random phases) to 1 (perfect phase locking).
Use Case: Useful for detecting transient synchronization.
PLI reflects the proportion of phase angle differences above or below the real (horizontal) axis.
Advantage:
It only measures phase synchronization, not amplitude correlation.
For multiple channels, you can compute PLI between all pairs to create a connectivity matrix.
PLI is insensitive to instantaneous (zero-lag) synchronization, which helps reduce the influence of volume conduction artifacts.
Interpretation: PLI = 0: no consistent phase locking (random phase differences), PLI = 1: perfect phase locking (constant phase difference).
High PLI: Indicates strong phase synchronization between the two signals, suggesting true interaction between sources.
Low PLI: Indicates weak or no phase synchronization.
Phase Locking Value (PLV)
Phase Locking Value (PLV): reflects the proportion of phase angle differences above or below the real (horizontal) axis.
It is used for measuring synchrony (especially changes in synchrony) across brain regions/electrodes.
\[ PLV = \frac{1}{N} \left \vert \sum{e^{1i \times (\varphi_1 - \varphi_2)}} \right \vert \] \(e^{\varphi_1 - \varphi_2}\) gives the randomness of \(\Delta \varphi\)
\(N\): number of segments to average. In practice it is best if you have a large number of trials.
Interpretation: PLV \(\approx\) 0: phases are randomly distributed (no phase locking), PLV ≈ 1: phases are highly synchronized (perfect phase locking).
PLV uses the Hilbert transform to calculate instantaneous phases, hence the signal should be narrowband.
Calculate PLV:
plv_data = plv(e10,
e10;
ch1 = "F3",
ch2 = "F4",
ep1 = 1,
ep2 = 1)
println("PLV: $(plv_data.pv[1])")PLV: 0.14681551787660263
Since we might be interested whether PLV changed after a stimulus, we need to normalize (using z score) using the the pre-stimulus period as a baseline (subtract z score of the baseline PLV values from PLV).
Imaginary Phase Locking Value (IPLV) was proposed to resolve PLV’s sensitivity to volume conduction and common reference effects.
\[ IPLV = \frac{1}{N} \left \vert \mathfrak{I} \left ( \sum{e^{1i \times (\varphi_1 - \varphi_2)}} \right ) \right \vert \]
iplv_data = iplv(e10,
e10;
ch1 = "F3",
ch2 = "F4",
ep1 = 1,
ep2 = 1)
println("IPLV: $(iplv_data.ipl[1])")IPLV: 0.062038174364113366