Skip to main content

Correlation

Namespace: CONNECTIVITYLIB  ·  Library: Connectivity Library

#include <connectivity/correlation.h>

class CONNECTIVITYLIB::Correlation

Computes the trial-averaged Pearson correlation coefficient between every channel pair from the raw time-domain trial data.

Per-trial correlation matrices are computed in parallel via QtConcurrent::mappedReduced and summed in reduce. The result is a symmetric matrix in [-1, 1]; it is broadband, zero-lag and does not reject volume conduction, so it is mainly useful as a baseline against the spectral and phase-based estimators.

Pearson correlation estimator; broadband, zero-lag time-domain baseline.

src/examples/ex_connectivity_metrics/main.cpp
Network correlation = Correlation::calculate(settings);
const double cor01 = edgeWeight(correlation, 0, 1);

Inheritance​


Public Methods​

Correlation()​

Constructs a Correlation object.


Static Methods​

calculate(connectivitySettings)​

Calculates the correlation coefficient between the rows of the data matrix.

Parameters:

Returns:

  • Network — The connectivity information in form of a network structure.

Example​

Used in examples​

ex_connectivity_metrics​

Connectivity metrics on synthetic data with a known coupling.

src/examples/ex_connectivity_metrics/main.cpp, line 233
Network correlation = Correlation::calculate(settings);
const double cor01 = edgeWeight(correlation, 0, 1);
Network crossCorrelation = CrossCorrelation::calculate(settings);
const double xcor01 = edgeWeight(crossCorrelation, 0, 1);
// Zero-lag Pearson r of the model: 0.5 cos(2 pi 10 Hz 12 ms) / sqrt(0.75 * 1.0) = 0.42
ok &= expect(std::fabs(cor01 - 0.42) < 0.05 && std::fabs(edgeWeight(correlation, 0, 2)) < 0.1,
QString("COR 0-1 %1 within 0.05 of 0.42, |0-2| < 0.1").arg(cor01));
ok &= expect(xcor01 > 2.0 * std::fabs(edgeWeight(crossCorrelation, 0, 2)),
QString("XCOR 0-1 %1 > 2 x |0-2|").arg(xcor01));

Authors of this file​