Phase Lag Index and Phase Locking Value

Initialize NeuroAnalyzer
using NeuroAnalyzer
import CairoMakie
# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of
# NeuroAnalyzer figures: remove it
delete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)
using DataFrames
using Statistics
NeuroAnalyzer.progress_bar = false

# resting-state EEG, EEG channels only, 10-second epochs
eeg = load_neuro("files/eeg/eeg.hdf")
eeg = keep_channel(eeg; ch = "eeg")
e10 = epoch(eeg; ep_len = 10)
# theta band (4-8 Hz): the dominant rhythm of this recording
e10_theta = NeuroAnalyzer.filter(e10;
                                 ch = "eeg",
                                 fprototype = :butterworth,
                                 ftype = :bp,
                                 cutoff = (4, 8),
                                 order = 4)
# channel pairs: ch1[i] with ch2[i]
ch1 = ["Fp1", "C3", "O1"]
ch2 = ["Fp2", "C4", "O2"]
pairs_lbl = ch1 .* "-" .* ch2

Phase-based connectivity measures describe the consistency of the phase difference between two signals, regardless of their amplitudes. They are calculated from the instantaneous phases of the signals (obtained using the Hilbert transform), so the signals must be narrow-band: here they are filtered in the theta band (4–8 Hz), the dominant rhythm of this recording.

  • The Phase Locking Value (PLV) measures how consistent the phase difference is, whatever its value (including 0).
  • The Phase Lag Index (PLI) and its variants measure how consistently one signal leads or lags the other; they ignore phase differences of 0 and π.

In the scalp EEG, a single source is recorded by many electrodes at the same time (volume conduction), which produces consistent phase differences of 0 (or π) between the electrodes, even without any interaction between brain regions. Measures that ignore zero-lag synchronization (PLI, wPLI, imaginary PLV) are therefore less affected by volume conduction, at the cost of missing true interactions with zero lag.

Feature PLV PLI / wPLI
Measures stability of the phase difference consistency of the sign of the phase difference
Zero-lag coupling included ignored
Volume conduction strongly affected much less affected
Range 0 to 1 0 to 1
Sensitivity to noise low PLI: high; wPLI: lower
Use case phase synchronization in general interactions between distinct sources

Phase Lag Index

The Phase Lag Index (PLI; Stam et al., 2007) measures the asymmetry of the distribution of phase differences around 0: whether one signal consistently leads (or lags) the other.

\[ \text{PLI} = \left \vert \frac{1}{N} \sum_{n=1}^{N} \text{sign}(\sin(\Delta \phi(t_n))) \right \vert \]

where:
\(\Delta \phi(t_n)\) is the phase difference at time \(t_n\),
\(\text{sign}(\sin(\Delta \phi))\) is 1 if the phase difference is in \((0, \pi)\) and −1 if it is in \((-\pi, 0)\).

  • PLI = 0: no consistent lead or lag (random phase differences, or a phase difference of 0 or π)
  • PLI = 1: one signal always leads the other

PLI does not show which signal leads (see dPLI below). Since small phase differences close to 0 flip their sign with any noise, PLI is sensitive to noise.

pli() calculates the PLI over the samples of each epoch (channel pairs × epochs):

p = pli(e10_theta, e10_theta; ch1 = ch1, ch2 = ch2)
size(p.pv)
(3, 100)

Weighted Phase Lag Index

The weighted Phase Lag Index (wPLI; Vinck et al., 2011) weights each phase difference by the magnitude of the imaginary part of the cross-spectrum, so that phase differences close to 0 or π (which are the most affected by noise and volume conduction) contribute little:

\[ \text{wPLI} = \frac{\left \vert \langle \text{Im}(S_{xy}) \rangle \right \vert}{\langle \vert \text{Im}(S_{xy}) \vert \rangle} \]

where:
\(S_{xy}\) is the cross-spectrum of the two signals,
\(\langle \cdot \rangle\) is the average over trials (or time points).

The debiased wPLI estimator (debiased = true) corrects the upward bias of wPLI for small numbers of trials. With several epochs, wPLI should be calculated across epochs (across_epochs = true), as in the original definition; within a single short epoch of a narrow-band signal it is biased upwards:

w = wpli(e10_theta,
         e10_theta;
         ch1 = ch1,
         ch2 = ch2,
         across_epochs = true,
         debiased = true)
size(w.pv)
(3, 1)

Directed Phase Lag Index

The directed Phase Lag Index (dPLI; Stam & van Straaten, 2012) is the proportion of time during which the phase of signal 1 leads the phase of signal 2:

  • dPLI > 0.5: signal 1 leads signal 2
  • dPLI < 0.5: signal 2 leads signal 1
  • dPLI = 0.5: no consistent lead or lag

The null value of dPLI is 0.5, while it is 0 for PLI and wPLI.

d = dpli(e10_theta, e10_theta; ch1 = ch1, ch2 = ch2)
size(d.pv)
(3, 100)

Phase Locking Value

The Phase Locking Value (PLV; Lachaux et al., 1999) is the length of the mean vector of the phase differences:

\[ \text{PLV} = \left \vert \frac{1}{N} \sum_{n=1}^{N} e^{i \Delta \phi(t_n)} \right \vert \]

  • PLV ≈ 0: random phase differences
  • PLV = 1: constant phase difference (perfect phase locking)

PLV calculated over time within an epoch is the same as ISPC (see the phase clustering tutorial); in event-related designs, PLV is often calculated across trials at each time point, and its change after a stimulus is expressed relative to the pre-stimulus baseline (e.g. as a z-score).

pl = plv(e10_theta, e10_theta; ch1 = ch1, ch2 = ch2)
size(pl.pv)
(3, 100)

The imaginary PLV (IPLV) is the absolute value of the imaginary part of the mean vector; zero-lag synchronization (a real mean vector) does not contribute to it:

\[ \text{IPLV} = \left \vert \text{Im} \left( \frac{1}{N} \sum_{n=1}^{N} e^{i \Delta \phi(t_n)} \right) \right \vert \]

ipl = iplv(e10_theta, e10_theta; ch1 = ch1, ch2 = ch2)
size(ipl.ipl)
(3, 100)

Comparison

The measures of the three pairs of channels, averaged over the 100 epochs (wPLI is calculated across the epochs):

avg(x) = vec(mean(x; dims = 2))
DataFrame(pair = pairs_lbl,
          PLV = avg(pl.pv),
          IPLV = avg(ipl.ipl),
          PLI = avg(p.pv),
          wPLI = vec(w.pv),
          dPLI = avg(d.pv))
3×6 DataFrame
Row pair PLV IPLV PLI wPLI dPLI
String Float64 Float64 Float64 Float64 Float64
1 Fp1-Fp2 0.208672 0.0859924 0.108516 0.301736 0.524625
2 C3-C4 0.439947 0.0817596 0.122914 0.163955 0.473355
3 O1-O2 0.69114 0.0740642 0.135953 0.533376 0.463289

O1 and O2 have the highest PLV. Their wPLI calculated across epochs is also high: the small phase lag between them has the same sign in most epochs, although within single epochs its sign often flips (low PLI). The PLI and IPLV, calculated within single 10-second epochs, are low for all pairs.

With a single object, the functions calculate the measure for all pairs of channels (channels × channels × epochs):

m = plv(e10_theta; ch = "eeg")
plot_matrix(m[:, :, 1];
            xlabels = labels(e10_theta),
            ylabels = labels(e10_theta),
            title = "PLV (4-8 Hz), epoch 1")
m = wpli(e10_theta; ch = "eeg", debiased = true)
plot_matrix(m[:, :, 1];
            xlabels = labels(e10_theta),
            ylabels = labels(e10_theta),
            title = "Debiased wPLI (4-8 Hz), epoch 1")

PLV is high for many pairs of channels, especially neighbouring ones, as expected from volume conduction; wPLI is much lower for most pairs. The high wPLI of Fz with many channels (a consistent phase lag of a single channel relative to all others) should be checked for technical causes, such as a reference or electrode problem, before it is interpreted as connectivity.

References

  1. Lachaux, J. P., Rodriguez, E., Martinerie, J., & Varela, F. J. (1999). Measuring phase synchrony in brain signals. Human Brain Mapping, 8(4), 194–208.
  2. Stam, C. J., Nolte, G., & Daffertshofer, A. (2007). Phase lag index: assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources. Human Brain Mapping, 28(11), 1178–1193.
  3. Vinck, M., Oostenveld, R., van Wingerden, M., Battaglia, F., & Pennartz, C. M. A. (2011). An improved index of phase-synchronization for electrophysiological data in the presence of volume-conduction, noise and sample-size bias. NeuroImage, 55(4), 1548–1565.
  4. Stam, C. J., & van Straaten, E. C. W. (2012). Go with the flow: use of a directed phase lag index (dPLI) to characterize patterns of phase relations in a large-scale model of brain dynamics. NeuroImage, 62(3), 1415–1428.