© 2025 Dr Nicolas Roehri
Introduction to functional connectivity
Definition of Functional Connectivity
Functional connectivity refers to the statistical relationship between signals recorded from different brain regions, reflecting their dynamic interactions over time. It can be assessed using various families of measures, including phase-based connectivity (e.g., Phase Locking Value, which quantifies phase synchronization), amplitude-based connectivity (e.g., Amplitude Envelope Correlation, which examines power co-modulations), and coherence, which captures both phase and amplitude relationships.
Regardless of the chosen method, extracting meaningful connectivity information requires computing the amplitude and phase of signals, typically using the Fourier transform \(\left(\mathcal{F}(.)\right)\) or the Hilbert transform \(\left(\mathcal{H}(.)\right)\).
Since these transformations yield complex-valued representations of the signals, it is often useful to apply Euler’s formula, which expresses a complex number in terms of its magnitude and phase, making it easier to manipulate and interpret in functional connectivity analyses.
$$ z = a + ib = Re^{i\theta}$$
with \(\Re(z) = a = R\cos(\theta)\) the real part, \( \Im(z) = b= R\sin(\theta)\) the imaginary part, \(\left|z\right| = R = \sqrt{a^2 + b^2}\) the absolute value or magnitude, \(\arg(z) = \theta = \arctan\left(\frac{b}{a}\right)\) the phase angle, with \(\theta \in \left[0, 2\pi\right[\) or \(\theta \in \left]-\pi, \pi\right]\) (the second definition will be used).
To illustrate the principle of the Fourier transform or Hilbert transform, we will define a simple signal.
Let us assume a noisy oscillating signal \(S\) of amplitude \(A(t)\), frequency \(f_S\), and phase shift \(\theta\) and \(\epsilon(t)\) the noise, drawn from a centered Normal distribution of standard deviation \(\sigma\). This signal is written as:
$$S(t) = A(t)\cos(2\pi f_St + \theta) + \epsilon(t),$$ $$\epsilon \sim \mathcal{N}(0,\sigma^{2}).$$
\(A\) takes the following form:
$$A(t) = \frac{1}{2}(m\cos(2\pi f_{A}t + \theta_{A}) + 1)$$
\(f_{A}\) the frequency of the cosine amplitude modulation, \(\theta_{A}\) the phase shift of the cosine amplitude modulation and \(m\) the amplitude of modulation. Let us set \(\theta_{A} = \pi\textrm{ rad}\) and \(m = \frac{4}{5}\).
\(f_S\), \(\theta\) and \(f_{A}\) can be tuned. Note that when \(f_{A} = 0\), \(A(t) = 1\)
Frequency domain (spectral method)
- Segment the Signal – Divide the continuous signal into trials (typically aligned to an event of interest or stimulus) or epochs (several time window of a fixed duration).
- Compute the Fourier Transform – Apply the Fourier Transform to each trial/epoch to obtain the complex frequency representation of the signal. This provides the amplitude and phase information for each frequency component.
- Compute the Metric of Interest – across the epochs/trials. This yields a connectivity metric for each frequency bin.
- Average Across Frequency Bands (Optional) – If interested in specific frequency bands (e.g., theta, alpha, beta), average the metric across the selected frequencies.
The Fourier transform provides the frequency content of a signal, as a complex number as:
$$\mathcal{F}_S(f)=\tilde{S}(f) = A'(f)e^{i\theta'(f)}$$
The Fourier transform gives us the amplitude \(A'(f)\) and the phase shift \(\theta'(f)\) for each frequency bin. Usually, one represents the power density across frequency bins (i.e. \(A'(f)/\Delta T\), with \(\Delta T\) the duration of the signal) referred to as the power spectral density (PSD) in \(V^2/Hz\).
In the example below, \(f_{A} = 0\) and \(A(t) = A =1\). This means that \(A^2 = A'^2(f_S)/\Delta T = 1\) and \(\theta=\theta'(f_S)\) in absence of noise (\(\sigma = 0\)).
There are key values to keep in mind:
- \(\theta=0 \implies S(0)\) starts at its peak;
- \(\theta=\frac{\pi}{2} \implies S(0)\) starts at the zero-crossing in its up-to-down phase;
- \(\theta=\pi\implies S(0)\) starts at its peak;
- \(\theta=-\frac{\pi}{2}=\frac{3\pi}{2} \implies S(0)\) starts at the zero-crossing zero in its down-to-up phase.
The plot below let you modify \(f_S\), \(\theta\) and \(\sigma\) and see their effect on the Fourier transform. You could start by modifying \(\theta\) to verify the above list.
Time domain
- Bandpass Filter the Signal – Apply a bandpass filter to isolate the frequency range of interest (e.g., theta, alpha, beta). The Hilbert transform is meaningful only within a defined frequency band.
- Compute the Analytic Signal – Apply the Hilbert Transform to obtain the analytic signal, which consists of:
- Real part: The original band-limited signal.
- Imaginary part: The Hilbert transform of the real part, forming a complex representation.
- Extract Amplitude and Phase – Compute:
- Instantaneous Amplitude (Envelope): The magnitude of the analytic signal.
- Instantaneous Phase: The phase angle, obtained using the arctangent function.
- Compute the Metric of Interest across the temporal dimension.
The analytic signal representation gives us the (instantaneous) amplitude of the envelope \(A(t)\) and the instantaneous phase \(\phi(t)\).
$$\widehat{S}(t)= S(t)+i\mathcal{H}(S(t)) = A(t)e^{i(2\pi f_St + \theta)}$$
The instantaneous phase is defined as:
$$\phi(t)= 2\pi f_St + \theta,$$
$$\textrm{so }\widehat{S}(t)= A(t)e^{i\phi(t)}.$$
There are key values to keep in mind:
- \(\phi(t)=0 \implies S(t)\) is at its peak;
- \(\phi(t)=\frac{\pi}{2} \implies S(t)\) is crossing zero in its up-to-down phase;
- \(\phi(t)=\pi\implies S(t)\) is at its peak;
- \(\phi(t)=-\frac{\pi}{2}=\frac{3\pi}{2} \implies S(t)\) is crossing zero in its down-to-up phase.
The plot below let you modify \(f_S\), \(\theta\), \(\sigma\), \(f_A\) and the time instant \(t\) to evaluate their effect on the envelope \(A(t)\) and instantaneous phase \(\phi(t)\). You could start by modifying spanning the different time instant \(t\) to verify that the above list is true regarless of the values of \(f_S\), \(\theta\) and \(f_A\).
Time-frequency domain
Time-frequency analysis decomposes a signal into its frequency components at different time points. This is commonly achieved using either the Short-Time Fourier Transform (STFT) or Analytic Continuous Wavelet Transform (CWT).
For the STFT, the signal is divided into short overlapping time windows (epochs) to capture local frequency changes. The Fourier Transform is computed within each window, providing a spectrogram with frequency resolution dependent on window size. The connectivity metric is then computed the same way as explained above in the frequency domain section.
CWT adapts the frequency resolution dynamically, offering better time resolution for high frequencies and better frequency resolution for low frequencies. Using analytic wavelets (e.g., complex Morlet or Morse wavelets) allows for the extraction of the analytic signal at each frequency bin, making it conceptually similar to the Hilbert Transform applied after bandpass filtering.
The connectivity metric is then computed the same way as explained above in the time domain section.
Average of complex numbers
When summing complex numbers, you can visualize each number as a vector in the complex plane.
In the cartesian coordinate system \((x,y)\) you have:
$$x = \Re(z) = a = R\cos(\theta),\quad y = \Im(z) = b = R\sin(\theta)$$
In the polar coordinate system \((R,\theta)\), where \(R)\) is the length of the vector and \(\theta)\) the angle/phase of the vector, you have:
$$R = \left|z\right|, \quad \theta = \arg(z)$$
For the purpose of this course, we will mainly use the polar form.
Given two complex numbers in polar form:
$$z_1= R_1e^{i\theta_1},\quad z_2= R_2e^{i\theta_2}.$$
You can visualise their sum as placing the tip of \(z_1\) at the origin, then placing \(z_2\) starting at the tip of \(z_1\). The resultant vector goes from the origin to the new tip. When the sum has more element you continue adding each element to the tip of the last resultant vector. If you want to compute the average you simply need to divide the resultant vector by the number of element.
- If the vectors are aligned (same phase), they add constructively, making the magnitude larger.
- If they are in opposite directions \(\theta_1 - \theta_2 = \pi\), they add destructively, reducing the magnitude.
- If they have different angles, the sum results in a new angle and magnitude.
Below, 3 cases are illustrated:
- the vectors have a length of 1 with similar angles, so the average resultant vector points in the same direction with a length close to 1,
- the vectors have a length of 1 but with different angles, so the average resultant vector is small and points in another direction,
- the vectors have a length of 1 with random orientations. You can click the 'Randomize' button to generate new samples.
Vectors with consistent phase
Vectors with inconsistent phase
Vectors with random phase