.backtick {font-size: 16px;})>><abbr {font-weight: bold;})>> <em strong {font-weight: normal; font-style: normal; padding: 2px; border-radius: 5px; background-color: #EEE; color: #111;})>>
= Tutorial 28: Connectivity =
'''[TUTORIAL UNDER DEVELOPMENT: NOT READY FOR PUBLIC USE] '''
''Authors: Hossein Shahabi, Raymundo Cassani, Takfarinas Medani''
Cognitive and perceptual functions are the result of coordinated activity of functionally specialized regions in the brain. [[http://www.scholarpedia.org/article/Brain_connectivity|Brain connectivity]] investigates how these different regions (or nodes) interact as a network, with the goal of having a better understanding of how the brain processes information. Depending on which connectivity characteristic is studied, a distinction is made between '''structural''' (fiber pathways), '''functional''' (non-directed statistical dependency) and '''effective''' (causal interaction) connectivity between regions. Effective connectivity is often referred as directed functional connectivity. In this tutorial we will see how to compute different connectivity metrics for non-directed and directed functional analyses in Brainstorm, first with simulated data and later with real data.
<>
== General considerations in connectivity analysis ==
Connectivity analyses are commonly performed by computing a bivariate connectivity metric for all the possible pairs of time series or signals. The result of such approach can be presented as a '''connectivity graph''' (left image), where each signal is represented as a node, and the value of the connectivity metric is the value of the edge between the corresponding nodes. This graph representation becomes overwhelming when too many nodes are considered, as such, the connectivity graph can be represented with its '''connectivity matrix''', aka adjacency matrix (right image).
{{attachment:cnx_graph_matrix.png}}
'''Sensors or sources:''' The signals used for the connectivity analysis can be derived from the '''sensor data''' (EEG/MEG signals) or from the reconstructed '''sources''' (voxels or scouts).
'''Directed and non-directed:''' The direction of the interaction between signals (as statistical causation) can be measured with '''directed metrics'''. However, this is not possible with '''non-directed metrics''', as result, the connectivity metric "from Signal <> to Signal <> " is equal to the connectivity metric "from Signal <> to Signal <>".
'''Recording condition:''' Connectivity analyses can be performed on resting-state (spontaneous) and event-related (trials) recordings, the appropriate connectivity method depends on the recording condition.
'''Full network vs point-based connectivity:''' In '''full network''', the connectivity metric is computed for all the possible node pairs in the network (N×N approach), and gives as result a detailed connectivity graph. Alternatively, '''point-based''' analysis is performed solely between one node (aka seed) and the rest of the nodes in the network (1×N approach), this approach is faster to compute and is more useful when you are interested in the connectivity of a specific sensor or source.
'''Temporal resolution:''' Connectivity analyses can be performed in two ways: static and dynamic. Time-varying networks can present the dynamics of brain networks. In contrast, the static graphs illustrate a general perspective of brain connectivity which is helpful in specific conditions. Users need to decide which type of network is more informative for their study.
'''Time-frequency transformation:''' Several connectivity metrics rely on the [[Tutorials/TimeFrequency|time-frequency representation]] of the signals, which is obtained with approaches such as the short-time Fourier transform, Hilbert transform, and Morlet wavelet.
/* {{attachment:GeneralFlowConn.png||width="700",height="230"}} */ /* {{attachment:SimSignals1.PNG||width="550",height="400"}} */
== Simulated data (MAR model) ==
To compare different connectivity metrics, we use simulated data with known ground truth. Consider three signals generated using the following multivariate autoregressive (MAR) process of 4th order.
{{{#!latex
\begin{eqnarray*}
x_1(n) & = & \sum_{k=1}^{4} A_{(1,1,k)}x_1(n-k) + e_1(n) \\
x_2(n) & = & \sum_{k=1}^{4} A_{(2,2,k)}x_2(n-k) + e_2(n) \\
x_3(n) & = & \sum_{k=1}^{4} A_{(3,3,k)}x_3(n-k) + \sum_{k=1}^{d} A_{(1,3,k)}x_1(n-k) + e_3(n)\\
\end{eqnarray*}
}}}
where <> with <> are coefficients of 4th order all-pole filters.
To compute these coefficients, we can consider a frequency response with desired pole and zero locations and use MATLAB zp2tf function for finding them.
Here, these coefficients were calculated in a way that the first signal has a dominant peak in the beta band (25 Hz), the second signal shows the highest power in the alpha band (10 Hz), and the third signal a similar level of energy in both bands. Additionally, the third signal is influenced by the first signal by the filter <>.
We simulate data using the ARfit process. To run that, first clear the process panel and then select simulate -> simulate AR signals (ARfit) and use the following coefficients
'''box for code''' '''Screenshot'''
For a MAR model, the transfer function (or frequency response) is defined as:
{{{#!latex
$$H_{i,j}(f) = \frac{1}{A_{i,j}(f)}$$\\
}}}
{{attachment:TransferMatrix3_AR3.png||width="550"}}
The diagonal elements show the auto-transfer function, which in our specific case is the spectrum of the signals. The off-diagonal terms represent the interactions between different signals. Here, we see the transfer function from signal 1 to signal 3. These transfer functions are our ground truth for connectivity values.
In the next sections we will compute different connectivity metrics for these simulated signals. As such, place the simulated data in the '''''Process1''''' tab, select recordings, click on '''''[Run]''''' ( {{https://neuroimage.usc.edu/moin_static198/brainstorm1/img/iconRun.gif}} ) to open the [[Tutorials/PipelineEditor#Selecting_processes|Pipeline editor]], and select the connectivity metric.
{{{#!wiki comment/dotted
This seems beyond the goal of the tutorial: Besides the original transfer functions, we can compute the [[https://en.wikipedia.org/wiki/Brain_connectivity_estimators#Directed_Transfer_Function|directed transfer function (DTF)]] and [[https://en.wikipedia.org/wiki/Brain_connectivity_estimators#Partial_Directed_Coherence|partial directed coherence (PDC)]].
{{attachment:Directed transfer function_AR3.png|Directed transfer function_AR3.png|width="550",height="400"}}
{{attachment:Partial Directed Coherence_AR3.png|Partial Directed Coherence_AR3.png|width="550",height="400"}}
}}}
== Correlation ==
[[https://en.wikipedia.org/wiki/Correlation_and_dependence|Correlation]] is a non-directed connectivity metric that can be used to show similarity, dependence or association among two random variables or signals. While this metric has been widely used in electrophysiology, it should not be considered the best technique to evaluate connectivity. Due to its nature, correlation fails to alleviate the problem of volume conduction and cannot explain the association in different frequency bands. However, it still can provide valuable information in case we deal with a few narrow-banded signals.
Let's compute the correlation for the simulated signals. Select the '''''Connectivity » Correlation NxN''''' process.
{{attachment:gui_corr1n.png||width="400"}} <
>
=== Process options ===
* '''Time window:''' Segment of the signal used for the connectivity analysis. Check '''''All file'''''.
* '''Sensor types or names:''' Leave it empty.
* '''Include bad channels:''' Check it.
* '''Process options:''' Uncheck it so the mean of the signals will be subtracted before computing the correlation.
* '''Output configuration''': Select Save individual results. <
>
=== Result visualization ===
After running a N×N connectivity process, the results are stored as a N×N connectivity file (with the icon {{https://neuroimage.usc.edu/moin_static198/brainstorm1/img/iconConnectN.gif}} ). Right-click on this file to see its display options:
* '''Display as graph''': plots the connectivity graph using a [[https://en.wikipedia.org/wiki/Chord_diagram|chord diagram]] where the color of the edges shows the connectivity metric value.
* '''Display as image''': plots the [[https://en.wikipedia.org/wiki/Adjacency_matrix|adjacent matrix]] for the connectivity file. <
><
> {{attachment:res_corr1n.png||width="700"}} <
>
{{{#!wiki note
In '''Display as image''', the value of the connectivity metric between a signal and itself plotted as '''zero''' so that it doesn't force scaling the colormap to 1 if the other values are much smaller.
}}}
== Coherence ==
Coherency or complex coherence, <>, is a complex-valued metric that measures of the linear relationship of two signals in the frequency domain. And, its magnitude square coherence (MSC), <>, often referred to as coherence, measures the covariance of two signals in the frequency domain. For a pair of signals <> and <>, with spectra <> and <>, the MSC is defined as:
. {{{#!latex
\begin{eqnarray*}
C^2_{xy}(f) &=& \left(\frac{\left |S_{xy}(f) \right |}{\sqrt{ S_{xx}(f)S_{yy}(f) }}\right)^2 = \frac{\left |X(f)Y^*(f) \right |^{2}}{X(f)X^*(f)Y(f)Y^*(f)} \\
S_{xy}(f) &:& \textrm{Cross-spectrum} \\
S_{xx}(f) \quad \textrm{and} \quad S_{yy}(f) &:& \textrm{Auto-spectra or power spectral densities} \\
\end{eqnarray*}
}}}
Two related measures, which alleviate the problem of volume conduction, are '''imaginary coherence''' ([[https://doi.org/10.1016/j.clinph.2004.04.029|Nolte et al., 2004]]), <>, and the '''lagged coherence''' ([[https://arxiv.org/pdf/0706.1776|Pascual-Maqui, 2007]]), <>, which are defined as:
. {{{#!latex
\begin{eqnarray*}
IC_{xy}(f) = \frac{\mathrm{Im} \left (S_{xy}(f) \right )}{\sqrt{ S_{xx}(f)S_{yy}(f) }} \qquad \qquad \qquad \qquad LC_{xy}(f) = \frac{\mathrm{Im} \left (S_{xy}(f) \right )}{\sqrt{ S_{xx}(f)S_{yy}(f) - \left [ \mathrm{Re}\left ( S_{xy}(f) \right ) \right ]^{2} }} \\
\end{eqnarray*}
}}}
where <> and <> describe the imaginary and real parts of a complex number.
To calculate coherence values in Brainstorm, select the '''''Connectivity » Coherence NxN''''' process.
{{attachment:gui_cohere1n.png||width="400"}} <
>
=== Process options ===
* '''Time window:''' Segment of the signal used for the connectivity analysis. Check '''''All file'''''.
* '''Sensor types or names:''' Leave it empty.
* '''Include bad channels:''' Check it.
* '''Removing evoked response''': Check this box to remove the averaged evoked
* '''Process options:''' Different types of coherence. Select Magnitude squared coherence.
* '''Overlap for PSD estimation:''' Percentage of overlap between consecutive windows for PSD estimation.
* '''Maximum frequency resolution''': Width of frequency bins in PSD estimation.
* '''Highest frequency of interest''': Highest frequency for the analysis, it should be <= Fs/2.
* '''Output configuration''': Select one file per input file.
=== Result visualization ===
Coherence is a function of frequency, as such, for each frequency point there is a connectivity graph and a connectivity matrix. Right-click on the coherence result file to see its display options:
* '''Display as graph''': Plot the connectivity graph at a given frequency point.
* '''Display as image''': Plot the connectivity matrix at a given frequency point.
* '''Power spectrum''': Plot coherence as a function of frequency for all the possible node pairs.
By clicking on the spectral representation of the coherence we change the frequency that is displayed in the connectivity graph and matrix. This frequency can be also changed in the Time panel.
{{attachment:res_cohere1n.png||width="700"}} <
>
In the same way, we can compute the other types of coherence. The figure below presents the spectra for the imaginary coherence (left) and the lagged coherence (right).
{{attachment:res_cohere1n_b.png||width="700"}} <
>
We see the last two measures are similar but have different values in several frequencies. However, both imaginary and lagged coherence are more accurate than coherence.
== Granger Causality ==
Granger causality (GC) is a method of directed functional connectivity, which is base on the Wiener-Granger causality methodology. GC is a measure of linear dependence, which tests whether the prediction of signal <> (using a linear autoregressive model) is improved by adding signal <> (also using a linear autoregressive model). If this is true, signal <> has a Granger causal effect on the first signal. In other words, '''independent information''' of the past of signal <> improves the prediction of signal <> obtained with the past of signal <> alone. GC is nonnegative, and zero when there is no Granger causality. As only the past of the signals is considered, the GC metric is directional. The term '''independent''' is emphasized because it creates some interesting properties for GC, such as, that it's invariant under rescaling of <> and <>, as well as the addition of a multiple of <> to <>. See [[GrangerCausality|Granger causality - mathematical background]] for a complete formulation of the method.
{{{#!wiki note
Despite the name, '''Granger causality indicates directionality but not true causality'''. <
> For example, if a variable <> is causing both <> and <>, but with a smaller delay for <> than for <>, then the GC measure between <> and <> would show a non-zero GC for <> --> <>, even though <> is not truly causing <> ([[https://doi.org/10.1016/j.neuroimage.2010.02.059|Bressler and Seth, 2011]]).
}}}
To compute the Granger causality values in Brainstorm, select the '''''Connectivity » Bivariate Granger causality NxN''''' process.
{{attachment:gui_granger1n.png||width="400"}} <
><
>
=== Process options ===
* '''Time window:''' Segment of the signal used for the connectivity analysis. Check '''''All file'''''.
* '''Sensor types or names:''' Leave it empty.
* '''Include bad channels:''' Check it.
* '''Removing evoked response''': Check this box to remove the averaged evoked. It is also recommended by some as it meets the zero-mean stationarity requirement (improves stationarity of the system). However, the problem with this approach is that it does not account for trial-to-trial variability (For a discussion see ([[https://doi.org/10.1016/j.neuroimage.2008.03.025|Wang et al., 2008]])).
* '''Model order:''' The most common criteria used to define the order of the model are the [[https://en.wikipedia.org/wiki/Akaike_information_criterion|Akaike’s information]] criterion, the [[https://en.wikipedia.org/wiki/Bayesian_information_criterion|Bayesian-Schwartz’s criterion]], and the [[https://en.wikipedia.org/wiki/Hannan%E2%80%93Quinn_information_criterion|Hannan-Quinn criterion]]. Too low orders may lack the necessary details, while too big orders tend to create spurious values of connectivity. While our simulated signals were created with a model of 4, here we used as model order of 6 for a decent connectivity result.
* '''Save individual results (one file per input file):''' option to save GC estimates on several files separately.
* '''Concatenate input files before processing (one file):''' option to save GC estimates on several files as one concatenated matrix.
=== Result visualization ===
In the connectivity graph (left) the directionality is shown as '''GRADIENT (TO BE UPDATED WITH THE NEW GRAPH LIBRARY)'''. As GC metric is not symmetric, the connectivity matrix (right) is not symmetric. The upper right element of this matrix shows there is a signal flow from signal 1 to signal 3.
<
><
> {{attachment:res_granger1n.png||width="700"}} <
><
>
== Spectral Granger causality ==
GC lacks of resolution in the frequency domain, as such, the spectral Granger causality was developed ([[https://doi.org/10.1103/PhysRevLett.100.018701|Dhamala et al., 2008]]). The process to calculate this metric is found in '''''Connectivity » Bivariate Granger causality NxN'''''.
{{attachment:gui_spgranger1n.png||width="400"}} <
><
>
=== Process options ===
With respect to GC, spectral GC presents two extra parameters:
* '''Maximum frequency resolution''': Width of frequency bins in PSD estimation.
* '''Highest frequency of interest''': Highest frequency for the analysis, it should be <= Fs/2.
=== Result visualization ===
As with coherence, spectral GC can be plotted as a function of frequency. The plot below clearly shows a peak at 25 Hz, as expected.
{{attachment:res_spgranger1n.png||width="325"}} <
><
>
== Envelope Correlation (2020) ==
In the [[Tutorials/TimeFrequency|time-frequency tutorial]] the Morlet wavelets and Hilbert transform were introduced as methods to decompose signals in the time-frequency (TF) domain. The result of this TF transformation can be seen as a set of narrowband complex signals, which are analytic signals. The [[https://en.wikipedia.org/wiki/Analytic_signal|analytic signal]], <>, is a complex signal uniquely associated to a real signal, <>, that has been useful in signal processing due to its characteristics, more specifically, its '''module''' <>, and '''phase''' <>, correspond to the '''instantaneous amplitude''' (or envelope) and '''instantaneous phase''' of the associated real signal <>. The real part of <> is its associated real signal <>, and the imaginary part is the Hilbert transform of the same real signal <>.
{{{#!latex
\begin{eqnarray*}
\tilde{x}(t)= x(t) + j\mathcal{H}\left\{ x(t) \right\} = a_{\tilde{x}}(t)e^{j\phi_{\tilde{x}}(t)} \\
\end{eqnarray*}
}}}
The instantaneous amplitude (or envelope) of these band analytic signals can be used to carry out pairwise connectivity analysis with metrics such as correlation and coherence (including lagged coherence). In computing the envelope correlation, an optional step is to orthogonalize the envelopes by removing their real part of coherence before the correlation ([[https://psycnet.apa.org/doi/10.1038/nn.3101|Hipp et al., 2012]]). This orthogonalization process alleviates the effect of volume conduction in MEG/EEG signals. These connectivity metrics can be computed with the '''''Connectivity » Envelope Correlation N×N [2020]''''' process.
{{attachment:gui_henv1n.png||width="400"}}
=== Process options ===
* '''Time window:''' Segment of the signal used for the connectivity analysis. Check '''''All file'''''.
* '''Sensor types or names:''' Leave it empty.
* '''Include bad channels:''' Check it.
* '''Removing evoked response''': Check this box to remove the averaged evoked
* '''Time-frequency transformation method:''' Either Hilbert transform or Morlet wavelets. Each of this methods requires additional parameters that are found in an external panel that opens by clicking on '''''Edit'''''. See the [[Tutorials/TimeFrequency|time-frequency tutorial]]
* '''Signal splitting:''' This process has the capability of splitting the input data into several blocks for performing time-frequency transformation, and then merging them to build a single file. This feature helps to save a huge amount of memory and, at the same time, avoid breaking a long-time recording to short-time signals, which makes inconsistency in dynamic network representation of spontaneous data. The maximum number of blocks which can be specified is 20.
* '''Connectivity measure:''' This is the connectivity metric that will be used with the envelopes.
* '''Parallel processing:''' Enables the use of the parallel processing toolbox in Matlab to accelerate the computational procedure.
* '''Output configuration:''' Generally, the above calculation results in a 4-D matrix, where dimensions represent channels (1st and 2nd dimensions), time points (3rd dimension), and frequency (4th dimension). In the case that we analyze event-related data, we have also several files (trials). However, due to the poor signal-to-noise ratio of a single trial, an individual realization of connectivity matrices for each of them is not in our interests. Consequently, we need to average connectivity matrices among all trials of a specific event. The second option of this part performs this averaging.
=== Result visualization ===
IMAGE
== Phase locking value ==
An alternative class of connectivity metrics considers only the relative instantaneous phase between the two signals, i.e., phase-locking or synchronization ([[https://doi.org/10.1103/PhysRevLett.81.3291|Tass et al., 1998]]). Phase locking is a fundamental concept in dynamical systems that has been used in control systems (the phase-locked loop) and in the analysis of nonlinear, chaotic and non-stationary systems. Since the brain is a nonlinear dynamical system, phase locking is an appropriate approach to quantifying connectivity. A more pragmatic argument for its use in studies of LFPs, EEG, and MEG is that it is robust to fluctuations in amplitude that may contain less information about interactions than does the relative phase ([[https://doi.org/10.1002/(SICI)1097-0193(1999)8:4%3C194::AID-HBM4%3E3.0.CO;2-C|Lachaux et al., 1999]]; [[https://doi.org/10.1016/S0167-2789(00)00087-7|Mormann et al., 2000]]).
The most commonly used phase connectivity metric is the phase-locking value (PLV), which is defined as the length of the average vector of many unit vectors whose phase angle corresponds to the phase difference between two signals ([[https://doi.org/10.1103/PhysRevLett.81.3291|Tass et al., 1998]]). If the distribution of the phase difference between the two signals is uniform, the length of such an average vector will be zero. Conversely, if the phases of the two signals are strongly coupled, the length of the average vector will approach unity. For event-related studies, we would expect the phase difference across trials to be uniform distributed unless the phase is locked to the stimulus. In that case, we may have nonuniform marginals which could in principle lead to indications of phase locking between two signals. Considering a pair of narrow-band analytic signals <> and <>, obtained from the TF transformation using the Hilbert transform:
{{{#!latex
\begin{eqnarray*}
\mathrm{PLV} = \left | E\left [ e^{j\Delta \phi (t)} \right ] \right | \\
\end{eqnarray*}
}}}
with:
{{{#!latex
\begin{eqnarray*}
\Delta \phi (t) = \phi_{\tilde{x}}(t) - \phi_{\tilde{y}}(t) = arg\left ( \frac{\tilde{x}(t)\tilde{y}^{*}(t)}{\left | \tilde{x}(t) \right |\left | \tilde{y}(t) \right |} \right ) \\
\end{eqnarray*}
}}}
{{attachment:plv.png}}
To calculate PLV in Brainstorm, select the '''''Connectivity » Phase locking value NxN''''' process.
{{attachment:gui_plv1n.png||width="400"}}
=== Process options ===
* '''Time window:''' Segment of the signal used for the connectivity analysis. Check '''''All file'''''.
* '''Sensor types or names:''' Leave it empty.
* '''Include bad channels:''' Check it.
* '''Frequency bands for the Hilbert transform:''' Frequency bands used for the time-frequency transformation with the Hilbert tranform method. See the [[Tutorials/TimeFrequency|time-frequency tutorial]]
* '''Keep time information:''' Computes PLV across trials, thus the result is a PLV time series for each frequency band.
* '''Measure:''' How the resulting vector is reported. Select '''''Magnitude'''''.
=== Result visualization ===
IMAGE
== Phase transfer entropy ==
Phase transfer entropy (PTE) is a directed connectivity metric that quantifies the [[https://en.wikipedia.org/wiki/Transfer_entropy|transfer entropy]] (TE) between two instantaneous phase time series ([[https://doi.org/10.1016/j.neuroimage.2013.08.056|Lobier et al., 2014]]). Similar to [[#Granger_Causality|GC]], TE estimates whether including the past of both source and target time-series influences the ability to predict the future of the target time-series. In PTE, if a phase signal <> causes the signal <>, the [[http://www.scholarpedia.org/article/Mutual_information|mutual information]], between <> and the past of <> i.e. <> is larger than the mutual information of <>, the past of <> i.e. <> and <>. This relationship can be seen on the Venn diagram below, where <> and <>, indicate mutual information and the individual entropies respectively. Lastly, PTE cannot be negative, and its magnitude does not have a meaningful upper bound.
{{attachment:pte.png}}
=== Process options ===
* '''Time window:''' Segment of the signal used for the connectivity analysis. Check '''''All file'''''.
* '''Sensor types or names:''' Leave it empty.
* '''Include bad channels:''' Check it.
* '''Frequency bands for the Hilbert transform:''' Frequency bands used for the time-frequency transformation with the Hilbert tranform method. See the [[Tutorials/TimeFrequency|time-frequency tutorial]]
* '''Return normalized phase transfer entropy:''' Divides the each directional PTE value between two signals by the sum of both directional PTE values for those two signals.
=== Result visualization ===
IMAGE
== Method selection and comparison ==
The following table list the available connectivity metrics in Brainstorm and their description.
||