v2.0.0
Loading...
Searching...
No Matches
CONNECTIVITYLIB::MvarModel Class Reference

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

#include <mvar_model.h>

Public Member Functions

 MvarModel ()=default
void fit (const Eigen::MatrixXd &data, int p=0)
QVector< Eigen::MatrixXd > coefficients () const
Eigen::MatrixXd noiseCov () const
int order () const
QVector< Eigen::MatrixXcd > transferFunction (const Eigen::VectorXd &freqs) const
QVector< Eigen::MatrixXcd > spectralMatrix (const Eigen::VectorXd &freqs) const

Detailed Description

MVAR model fit; provides H(f) and S(f) for Granger Causality, DTF and PDC.

Multivariate autoregressive (MVAR) model fit and its frequency-domain decomposition into transfer function H(f) and spectral matrix S(f).

The model order p is either supplied by the caller or selected automatically by Bayesian Information Criterion over [1, 20]; the coefficient matrices are estimated by Levinson-Durbin recursion on the Yule-Walker equations. The resulting H and S are consumed by the three directed-connectivity metrics in this library (Granger Causality, DTF, PDC) and are exposed via transferFunction and spectralMatrix at arbitrary normalised frequencies.

Since
2.2.0

Definition at line 88 of file mvar_model.h.

Constructor & Destructor Documentation

◆ MvarModel()

CONNECTIVITYLIB::MvarModel::MvarModel ( )
default

Constructs a default MvarModel object.

Member Function Documentation

◆ coefficients()

QVector< MatrixXd > MvarModel::coefficients ( ) const

Returns the fitted coefficient matrices A_1 .. A_p (each nChannels x nChannels).

Returns
The MVAR coefficient matrices.
Since
2.2.0

Definition at line 60 of file mvar_model.cpp.

◆ fit()

void MvarModel::fit ( const Eigen::MatrixXd & data,
int p = 0 )

Fits an MVAR model of order p to multi-channel data.

Parameters
[in]dataThe input data matrix (nChannels x nSamples).
[in]pThe model order. If 0, the order is auto-selected via BIC.
Since
2.2.0

Definition at line 47 of file mvar_model.cpp.

◆ noiseCov()

MatrixXd MvarModel::noiseCov ( ) const

Returns the noise covariance matrix (nChannels x nChannels).

Returns
The noise covariance matrix.
Since
2.2.0

Definition at line 67 of file mvar_model.cpp.

◆ order()

int MvarModel::order ( ) const

Returns the fitted model order.

Returns
The model order p.
Since
2.2.0

Definition at line 74 of file mvar_model.cpp.

◆ spectralMatrix()

QVector< MatrixXcd > MvarModel::spectralMatrix ( const Eigen::VectorXd & freqs) const

Computes the spectral matrix S(f) = H(f) * Sigma * H(f)^H.

Parameters
[in]freqsVector of normalized frequencies in [0, 0.5].
Returns
Vector of nChannels x nChannels complex matrices, one per frequency.
Since
2.2.0

Definition at line 107 of file mvar_model.cpp.

◆ transferFunction()

QVector< MatrixXcd > MvarModel::transferFunction ( const Eigen::VectorXd & freqs) const

Computes the transfer function H(f) at the given normalized frequencies.

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

Parameters
[in]freqsVector of normalized frequencies in [0, 0.5].
Returns
Vector of nChannels x nChannels complex matrices, one per frequency.
Since
2.2.0

Definition at line 81 of file mvar_model.cpp.


The documentation for this class was generated from the following files: