Amplitude Envelope Correlation

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)

Amplitude Envelope Correlation (AEC) is the correlation between the amplitude envelopes of two narrow-band signals: it measures whether the strength of an oscillation in two regions rises and falls together (co-activation), regardless of the phase relationship.

\[ \text{AEC} = \text{corr}(A_1(t), A_2(t)) \]

where:
\(A_1(t)\), \(A_2(t)\) are the amplitude envelopes of the two signals (the absolute value of their analytic signals, obtained using the Hilbert transform).

Interpretation:

  • AEC = 1: the envelopes change together
  • AEC = 0: no relationship between the envelopes
  • AEC < 0: when the amplitude increases in one signal, it decreases in the other

Use case: co-activation of brain regions in specific frequency bands; amplitude coupling is the basis of many resting-state network studies (especially in MEG).

Limitations:

  • Not phase-specific: it does not capture timing relationships.
  • Sensitive to volume conduction: a source recorded by two electrodes produces correlated envelopes. In source-space analyses this is reduced by orthogonalizing the signals before the envelopes are calculated (leakage correction, Hipp et al., 2012).
  • The envelopes change slowly, so long segments are required for a reliable estimate.

The signals must be narrow-band, since the envelope of a broad-band signal is not meaningful; here the theta band (4–8 Hz) is used.

aecor() calculates the AEC between pairs of channels (ch1[i] with ch2[i]) in each epoch:

ch1 = ["Fp1", "C3", "O1"]
ch2 = ["Fp2", "C4", "O2"]
aec = aecor(e10_theta, e10_theta; ch1 = ch1, ch2 = ch2)
DataFrame(pair = ch1 .* "-" .* ch2,
          aec_epoch1 = aec[:, 1],
          aec_mean = vec(mean(aec; dims = 2)))
3×3 DataFrame
Row pair aec_epoch1 aec_mean
String Float64 Float64
1 Fp1-Fp2 0.29524 0.147606
2 C3-C4 0.646905 0.315019
3 O1-O2 0.778878 0.614722

With a single object, the AEC of all pairs of channels is calculated (channels × channels × epochs):

m = aecor(e10_theta; ch = "eeg")
plot_matrix(dropdims(mean(m; dims = 3); dims = 3);
            xlabels = labels(e10_theta),
            ylabels = labels(e10_theta),
            title = "AEC (4-8 Hz), mean of all epochs")

Envelope Correlation with a Significance Test

env_cor() calculates the correlation of any two envelopes, with the p-value of the correlation test. The envelopes must be arrays of shape (channels, samples, epochs). Here, upper envelopes (cubic spline through the local maxima, see env_up()) of O1 and O2 in the first epoch:

s1 = e10_theta.data[get_channel(e10_theta; ch = "O1"), :, 1][:]
s2 = e10_theta.data[get_channel(e10_theta; ch = "O2"), :, 1][:]
env1 = env_up(s1, e10_theta.epoch_time)
env2 = env_up(s2, e10_theta.epoch_time)
ec = env_cor(reshape(env1, 1, :, 1), reshape(env2, 1, :, 1))
println("Envelope correlation: ", round(ec.ec[1]; digits = 3))
println("p-value: ", ec.p[1])
Envelope correlation: 0.786
p-value: 0.0

Tip: the samples of an envelope are strongly autocorrelated (the envelope changes slowly), so the p-value of a correlation test that treats each sample as independent is far too small; use surrogate data (e.g. correlations of envelopes from different epochs) to test significance.

Envelope-to-Signal Correlation

Envelope-to-Signal Correlation (ESC; Bruns & Eckhorn, 2004) is the correlation between the (band-limited) signal of one channel and the amplitude envelope of another:

\[ \text{ESC} = \text{corr}(S_1(t), A_2(t)) \]

where:
\(S_1(t)\) is the first signal,
\(A_2(t)\) is the amplitude envelope of the second signal.

ESC is high when the signal of the first channel follows the amplitude of the second, e.g. when a slow oscillation modulates the amplitude of a faster one (cross-frequency coupling); it is not symmetric. Both signals are filtered in the bands of interest (which may differ) before the calculation.

esc = escor(e10_theta, e10_theta; ch1 = ch1, ch2 = ch2)
DataFrame(pair = ch1 .* "-" .* ch2,
          esc_mean = vec(mean(esc; dims = 2)))
3×2 DataFrame
Row pair esc_mean
String Float64
1 Fp1-Fp2 -0.00216737
2 C3-C4 0.000503172
3 O1-O2 0.00124531

For signals filtered in the same band, the ESC is close to 0: the signal oscillates around zero many times within each rise and fall of the envelope.

References

  1. Bruns, A., & Eckhorn, R. (2004). Task-related coupling from high- to low-frequency signals among visual cortical areas in human subdural recordings. International Journal of Psychophysiology, 51(2), 97–116.
  2. Hipp, J. F., Hawellek, D. J., Corbetta, M., Siegel, M., & Engel, A. K. (2012). Large-scale cortical correlation structure of spontaneous oscillatory activity. Nature Neuroscience, 15(6), 884–890.