usingNeuroAnalyzerimportCairoMakie# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of# NeuroAnalyzer figures: remove itdelete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)usingStatisticsNeuroAnalyzer.Random.seed!(1)
Brain connectivity describes how brain regions are connected and interact:
structural connectivity: anatomical connections (white matter tracts, synapses), e.g. from diffusion MRI
functional connectivity: statistical dependencies between the signals of different regions (e.g. correlation, phase synchronization); it is undirected and does not imply a direct anatomical connection or a causal interaction (two regions driven by a common third region are functionally connected)
effective connectivity: directed (causal) influences of one region on another (e.g. Granger causality, phase slope index, dynamic causal modelling)
Connectivity in EEG/MEG is usually frequency-specific (e.g. alpha, beta or gamma band) and dynamic (it changes with the cognitive state, the task and over time). It is used to study the organization of brain networks, cognitive processes that rely on the cooperation of distributed regions, and their disruption in neurological and psychiatric disorders (e.g. epilepsy, schizophrenia, dementia).
Measures
Phase-based measures
Phase synchronization (a consistent phase relation between oscillations) is thought to support communication between regions. Phase-based measures use the instantaneous phases of narrowband signals (band-pass filtered and Hilbert-transformed, or from wavelets).
Phase locking value (PLV) and inter-site phase clustering (ISPC): the length of the mean vector of the phase differences, \(|\langle e^{i(\varphi_1 - \varphi_2)} \rangle|\); 0: random phase differences, 1: constant phase difference. ISPC, PLV
Imaginary PLV (iPLV): the imaginary part of the mean vector; zero for a phase difference of 0 or π.
Phase lag index (PLI): the asymmetry of the distribution of phase differences around zero, \(|\langle \mathrm{sign}(\sin(\varphi_1 - \varphi_2)) \rangle|\); insensitive to zero-lag synchronization. PLI
Weighted PLI (wPLI): PLI weighted by the magnitude of the imaginary part of the cross-spectrum, \(|\langle \Im(S_{xy}) \rangle| / \langle |\Im(S_{xy})| \rangle\), calculated across trials (epochs); less sensitive to noise near zero lag than PLI, with a debiased version for small numbers of trials. wPLI
Directed PLI (dPLI) and phase slope index (PSI): which signal leads (directed measures).
Inter-trial phase clustering (ITPC) uses the same formula as ISPC, but across trials at one channel: it measures the consistency of the phase relative to an event (phase locking to the stimulus), not connectivity between regions. ITPC
Spectral measures
Coherence is the frequency-domain correlation between two signals: the normalized cross-spectrum, \(C_{xy}(f) = S_{xy}(f) / \sqrt{S_{xx}(f) S_{yy}(f)}\), estimated over epochs (or segments). It depends on both the phase consistency and the amplitude correlation.
Amplitude-based measures capture correlations of power (amplitude envelopes) between regions, which may reflect co-activation even without phase synchronization.
Amplitude envelope correlation (AEC): the correlation of the Hilbert envelopes of band-pass filtered signals; with orthogonalization (removing the zero-lag component of one signal from the other before computing the envelopes) it becomes insensitive to volume conduction. AEC
Envelope-signal correlation and other measures, see Other Methods.
General and non-linear measures
Correlation, covariance, cosine similarity, mutual information and synchronization likelihood (a non-linear measure of generalized synchronization) describe dependencies regardless of frequency, see Other Methods.
Directed measures (effective connectivity)
Granger causality: a signal \(x\) “Granger-causes” \(y\) if the past of \(x\) improves the prediction of \(y\) beyond the past of \(y\) itself (autoregressive models); spectral versions give directed connectivity per frequency. Other measures: the phase slope index, directed PLI, partial directed coherence, transfer entropy.
Volume Conduction
The main problem of sensor-level EEG/MEG connectivity is volume conduction (and field spread): the activity of a single source is recorded by many electrodes at the same time, without delay, so neighbouring channels are correlated and phase-synchronized even without any interaction between brain regions. The common reference adds further shared signal to all channels.
Because volume conduction is instantaneous, it produces phase differences of 0 (or π). Measures based on the imaginary part of the cross-spectrum or on non-zero phase lags (PLI, wPLI, iPLV, imaginary coherence, orthogonalized AEC) ignore it; the price is that true zero-lag interactions are ignored as well.
Simulated example: two channels recording a 10 Hz oscillation in 30 two-second epochs, with independent noise, band-pass filtered at 8–12 Hz:
zero lag: channel B records the same source as channel A (scaled), like two electrodes recording one source through volume conduction
lag π/4: channel B follows channel A with a phase delay of π/4 (25 ms at 10 Hz), like a true interaction with a conduction delay
fs =256n =2* fsn_ep =30t = (0:(n -1)) ./ fsfunctionsimulate(lag) a =zeros(n, n_ep) b =zeros(n, n_ep)for ep in1:n_epφ=2π *rand() # random phase in each epoch src =sin.(2π *10.* t .+φ) a[:, ep] = src .+0.5.*randn(n) b[:, ep] = (lag ==0 ? 0.8.* src :sin.(2π *10.* t .+φ.- lag)) .+0.5.*randn(n)end obj =create_object(; data_type ="eeg") obj.header.recording[:sampling_rate] = fsappend_channel!(obj; data =permutedims(cat(a, b; dims =3), (3, 1, 2)), label = ["A", "B"],type= ["eeg", "eeg"], unit = ["μV", "μV"])create_time!(obj; fs = fs) NeuroAnalyzer.filter!(obj; ch ="all", fprototype =:fir, ftype =:bp, cutoff = (8, 12), bw =2)return objend
zero lag PLV: 0.99 PLI: 0.3 wPLI: 0.07 coherence: 0.97 |imag. coherence|: 0.0
lag π/4 PLV: 0.97 PLI: 0.98 wPLI: 1.0 coherence: 0.97 |imag. coherence|: 0.7
PLV and coherence are high in both cases and cannot distinguish volume conduction from a true interaction. PLI, wPLI and imaginary coherence are high only for the lagged coupling.
PLI is calculated within each epoch (across its time points) and averaged over epochs; for the zero-lag case it is not exactly 0: within a short epoch of a narrowband signal, noise shifts the phase difference to one side of zero for long stretches. wPLI and imaginary coherence are calculated across epochs (wpli(...; across_epochs = true)), where such random shifts cancel out; debiased = true further removes the positive bias of wPLI caused by a limited number of epochs.
Other ways to reduce volume conduction:
Spatial filters: the surface Laplacian or current source density (CSD) reduce the spread of potentials and the effect of the reference.
Source space: estimating the activity of brain sources (e.g. beamformers, minimum-norm estimates) before connectivity analysis; source leakage remains and must also be considered.
Distance: interpreting connectivity mainly between distant channels.
Graph-Theoretic Measures
Graph theory describes the large-scale organization of brain networks from connectivity matrices:
nodes: channels or brain regions
edges: connectivity values between nodes (weighted, or binary after thresholding)
Metric
Description
Use
Degree / strength
number (or sum of weights) of the connections of a node
identifying hubs
Clustering coefficient
how strongly the neighbours of a node are connected with each other
local (segregated) processing
Characteristic path length
average shortest path between all pairs of nodes
global (integrated) processing
Global efficiency
average inverse shortest path length
integration (robust to disconnected nodes)
Modularity
strength of the division of the network into modules (communities)
functional modules
Small-worldness
high clustering with a short path length, relative to random networks
efficient network organization
Graph measures depend strongly on the connectivity measure, the number of nodes, thresholding and normalization; they should be compared with appropriate random (null) networks.
Practical Considerations
Preprocessing:
Artifacts: remove artifacts (ICA, rejection); eye movements, muscle activity and line noise produce strong spurious connectivity.
Reference: the reference is shared by all channels and affects all sensor-level connectivity measures; the average reference, the Laplacian or source space reduce its influence.
Epochs: equal numbers and lengths of epochs in the compared conditions.
Biases:
PLV, coherence and other measures are biased by the number of epochs (with few epochs, random phases give high values); compare conditions with equal numbers of epochs or use debiased measures (e.g. pairwise phase consistency, debiased wPLI).
Power differences change the signal-to-noise ratio and therefore the phase estimates: a difference in connectivity between conditions may be caused by a difference in power.
Common input from a third region produces connectivity without a direct interaction.
Statistics:
Surrogate data and permutation tests: the observed connectivity is compared with a null distribution (e.g. epochs shuffled between channels, time-shifted or phase-randomized signals).
Multiple comparisons: many channel pairs and frequencies are tested; use FDR, Bonferroni or cluster-based permutation tests.
Effect sizes (e.g. Cohen’s d) quantify the differences between conditions or groups.
Limitations and Challenges
Challenge
Description
Approach
Volume conduction
one source recorded by many channels gives spurious zero-lag connectivity
lag-based measures (PLI, wPLI, imaginary coherence), Laplacian/CSD, source space
Reference
the shared reference adds common signal
average reference, Laplacian, source space
Common input
a third region drives both regions
multivariate (partial, conditional) measures
Number of epochs
measures are biased with few epochs
equal epoch numbers, debiased measures
Power differences
connectivity estimates depend on the signal-to-noise ratio
control for power, report power
Non-stationarity
connectivity changes over time
time-resolved (sliding window) connectivity
Artifacts
eye, muscle and line-noise artifacts are shared by many channels
careful preprocessing
Directionality
undirected measures do not show the direction of interactions
Granger causality, PSI, dPLI, transfer entropy
Summary
Measure
Type
Frequency-specific
Directed
Insensitive to zero-lag volume conduction
PLV / ISPC
phase
yes
no
no
iPLV
phase
yes
no
yes
PLI
phase
yes
no
yes
wPLI
phase
yes
no
yes
dPLI
phase
yes
yes
yes
PSI
phase
yes
yes
yes
Coherence
spectral
yes
no
no
Imaginary coherence
spectral
yes
no
yes
AEC
amplitude
yes
no
no (yes with orthogonalization)
Correlation
general
no (unless filtered)
no
no
Mutual information, synchronization likelihood
non-linear
no (unless filtered)
no
no
Granger causality
directed
yes (spectral version)
yes
partly
ITPC
phase consistency across trials (not connectivity)