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 |
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.
Definition at line 88 of file mvar_model.h.
|
default |
Constructs a default MvarModel object.
| QVector< MatrixXd > MvarModel::coefficients | ( | ) | const |
Returns the fitted coefficient matrices A_1 .. A_p (each nChannels x nChannels).
Definition at line 60 of file mvar_model.cpp.
| void MvarModel::fit | ( | const Eigen::MatrixXd & | data, |
| int | p = 0 ) |
Fits an MVAR model of order p to multi-channel data.
| [in] | data | The input data matrix (nChannels x nSamples). |
| [in] | p | The model order. If 0, the order is auto-selected via BIC. |
Definition at line 47 of file mvar_model.cpp.
| MatrixXd MvarModel::noiseCov | ( | ) | const |
Returns the noise covariance matrix (nChannels x nChannels).
Definition at line 67 of file mvar_model.cpp.
| int MvarModel::order | ( | ) | const |
Returns the fitted model order.
Definition at line 74 of file mvar_model.cpp.
| QVector< MatrixXcd > MvarModel::spectralMatrix | ( | const Eigen::VectorXd & | freqs | ) | const |
Computes the spectral matrix S(f) = H(f) * Sigma * H(f)^H.
| [in] | freqs | Vector of normalized frequencies in [0, 0.5]. |
Definition at line 107 of file mvar_model.cpp.
| 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}
| [in] | freqs | Vector of normalized frequencies in [0, 0.5]. |
Definition at line 81 of file mvar_model.cpp.