v2.0.0
Loading...
Searching...
No Matches
mvar_model.h File Reference

Multivariate autoregressive (MVAR) model fit and its frequency-domain decomposition; backbone of the directed connectivity metrics. More...

#include "../connectivity_global.h"
#include <QVector>
#include <Eigen/Core>
Include dependency graph for mvar_model.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CONNECTIVITYLIB::MvarModel
 MVAR model fit; provides H(f) and S(f) for Granger Causality, DTF and PDC. More...

Namespaces

namespace  CONNECTIVITYLIB
 Functional connectivity metrics (coherence, PLV, cross-correlation, etc.).

Detailed Description

Multivariate autoregressive (MVAR) model fit and its frequency-domain decomposition; backbone of the directed connectivity metrics.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.2.0
Date
April 2026

The MVAR(p) model expresses each channel as a linear combination of the last p samples of all channels plus white innovation noise,

X[t] = sum_{k=1}^{p} A_k * X[t - k] + E[t], E ~ N(0, Sigma)

Taking the z-transform with z = exp(-2*pi*i*f) gives the spectral representation X(f) = H(f) * E(f) with transfer matrix

H(f) = ( I - sum_{k=1}^{p} A_k * exp(-2*pi*i*f*k) )^{-1}

and spectral matrix S(f) = H(f) * Sigma * H(f)^H. H and S are the only two quantities the directed-connectivity metrics in this library actually need: spectral Granger Causality (GrangerCausality) is a ratio of diagonal entries of S before and after conditioning, the Directed Transfer Function (DirectedTransferFunction) is a row- normalised |H_{ij}(f)|^2, and Partial Directed Coherence (PartialDirectedCoherence) is a column-normalised |A_{ij}(f)|.

The coefficient matrices A_1..A_p and the innovation covariance Sigma are estimated from the Yule-Walker equations via Levinson- Durbin recursion (numerically stable, O(p^2 * n^2)); the model order defaults to a Bayesian Information Criterion search over [1, 20] when the caller passes p = 0.

Definition in file mvar_model.h.