Skip to content

Cross-signal analyses

Command Description
COH Pairwise channel coherence
CORREL Pairwise channel correlation
MI Mutual information
Channel location maps Specifying channel location maps
L1OUT Leave-one-out interpolation for multichannel EEG

COH

Calculates pairwise spectral coherence across channels

The COH function calculates the magnitude-squared coherence for pairs of signals with similar sampling rates.

Parameters
Parameter Example Description
sig sig=C3,C4 An optional parameter, to specify which channels to calculate pairwise coherence between
sr sr=125 Optionally, set sample rates to sr if different for a particular channel (i.e. to ensure that all signals have similar sampling rates
spectrum spectrum Output full cross-spectra coherence rather than just in frequency bands (delta, theta, etc)
epoch epoch A flag to output coherence statistics for either each epoch or for the whole signal

Warning

If requesting the full spectrum and epoch-level analyses for a large number of channels, the output database may be very large....

Output

Coherence for power bands (B x CHS)

Variable Description
COH Magnitude-squared coherence

Full cross-spectra coherence (option: spectrum, strata: F x CHS)

Variable Description
COH Magnitude-squared coherence

Coherence for power bands, per epoch (option: epoch, strata: E x B x CHS)

Variable Description
COH Magnitude-squared coherence

Full cross-spectra, per epoch (option: epoch and spectrum, strata: E x F x CHS)

Variable Description
COH Magnitude-squared coherence
ASPEC1 Auto-spectra for first channel
ASPEC2 Auto-spectra for second channel
CSPEC Cross-spectra
Example

To estimate the cross-spectra (up to 20 Hz) between the two EEG channels during NREM2 sleep for the tutorial individual nsrr02:

luna s.lst nsrr02 -o out.db -s "MASK ifnot=NREM2 & RE \
                                & COH spectrum max=20 sig=EEG,EEG(sec)"

Loading this into lunaR,

k <- ldb( "out.db" ) 
and extracting the relevant data frame:
d <- lx(k,"COH","CHS","F")
and plotting:
plot( d$F, d$COH , type="l" , 
      xlab="Frequency (Hz)" , ylab="Coherence" , 
      ylim=c(0,1) , lwd=2, col="red")

img

Following other reports (for example), we see peaks in EEG coherence especially for the low delta and sigma frequencies during NREM sleep. Naturally, the precise interpretation of coherence analysis (like any sleep EEG analysis) depends on the exact choice of montages, referencing and other technical and subject-level details, not to mention the potential for artifact (e.g. as illustrated here).

CORREL

Calculates pairwise Pearson correlation between signals

CORREL estimates pairwise correlation coefficients between signals, either for the whole signal, or epoch-by-epoch. When epoch-level statistics are requested, Luna also reports the mean and median of all per-epoch statistics for a given channel pair.

Parameters
Parameter Example Description
sig sig=C3,C4,F3,F4 Optionally specify which signals to correlate (otherwise, do all)
sr sr=128 Resample channels to this sample rate, if they are not already at that rate
epoch epoch Estimate mean and median correlation across epochs
verbose verbose Display per-epoch correlations
Output

Whole-signal correlations for pairs of channels (strata: CHS)

Variable Description
R Pearson product moment correlation
R_MEAN (If epoch is specified) the mean of epoch-level correlations
R_MEDIAN (If epoch is specified) the median of epoch-level correlations

Whole-signal correlations for pairs of channels (option: verbose, strata: E x CHS)

Variable Description
R Per-epoch Pearson product moment correlation
Example

Here we consider the epoch-by-epoch correlation between the two EOG channels for tutorial subject nsrr02. Using lunaC to estimate and report correlations at the epoch level:

luna s.lst nsrr02 -o out.db -s "MASK if=wake & RE \
                                & STAGE \
                                & CORREL epoch verbose sig=EOG(L),EOG(R)"
Note that the above command also reports the manually-assigned stage of each epoch (with the STAGE command, which we can use later when plotting results:

Using lunaR to examine the output (in R):

library(luna)

We'll attach the output database just created:

k <- ldb( "out.db" )

Examining the contents with lx():

lx(k)
CORREL : CHS CHS_E 
MASK : EPOCH_MASK 
RE : BL 
STAGE : E 

First, we'll extract a simple vector of sleep stage (the STAGE variable from the STAGE command):

ss <- lx( k , "STAGE" , "E" )$STAGE 

Second, we'll extract the epoch-by-epoch correlations:

d <- lx( k , "CORREL" , "CHS" , "E" ) 

Viewing data-frame d, note that the epochs (E) do not start at 1, because we previously restricted this analysis to sleep epochs:

head(d)
> head(d)
      ID           CHS   E         R
1 nsrr02 EOG(L)xEOG(R)  92 0.5052592
2 nsrr02 EOG(L)xEOG(R)  93 0.7998685
3 nsrr02 EOG(L)xEOG(R)  98 0.4698097
4 nsrr02 EOG(L)xEOG(R)  99 0.3147986
5 nsrr02 EOG(L)xEOG(R) 100 0.3153311
6 nsrr02 EOG(L)xEOG(R) 101 0.6581321

Finally, we can plot these epochs:

plot( d$E , d$R , col = lstgcols( ss ) , pch=20 , ylab="L-R EOG correlation", xlab="Epoch", ylim=c(-1,1) )
abline( h=0 , lty=2 )

img

For this particular individual, there seems to be a clear and interesting pattern, in which we see that REM epochs (in red) are more likely to show negative correlations between the left and right EOG, reflecting the deviations due to eye-movements during REM.

MI

Calculates pairwise mutual information metrics across channels

Estimates mutual information, a measure of dependence between two signals, based on methods described in Analyzing Neural Time Series Data by MX Cohen. Total correlation and dual total correlation are two normalized variants of the mutual information statistic: MI / min[ H(X), H(Y) ] and MI/H(X,Y) respectively, where MI is mutual information, H(X) and H(Y) are the marginal entropies, and H(X,Y) is the joint entropy.

Signals are first coarse-grained: the number of bins is determined by one of three rules: Freedman-Diaconis (default), Scott or Sturges rule, as described in Cohen.

Parameters
Parameter Example Description
sig sig=C3,C4,F3,F4 Optionally specify channels (default is to include all)
epoch epoch Calculate and report MI and other measures per epoch
scott scott Use Scott's rule to determine bin number
sturges sturges Use Sturges' rule to determine bin number
permute permute=1000 Estimate empirical significance via permutation, e.g. with 1000 null replicates

Alert

Permutation and epoch-level analyses with the MI command can be relatively slow .

Output

Output for the whole signal (strata: CHS)

Variable Description
MI Mutual information
TOTCORR Total correlation
DTOTCORR Dual total correlation
JINF Joint entropy
INFA Marginal entropy of first signal
INFB Marginal entropy of second signal
NBINS Number of bins

Output per-epoch, with epoch (option: epoch, strata: CHS)

Variable Description
MI Mutual information
TOTCORR Total correlation
DTOTCORR Dual total correlation
JINF Joint entropy
INFA Marginal entropy of first signal
INFB Marginal entropy of second signal

Output for permutation test (option: permute)

Variable Description
EMP Empirical p-value for mutual information statistic
Z Z-statistic

Channel locations

Documentation to be added

L1OUT

Documentation to be added