tsdata_to_var
Fit VAR model to multi-trial, multivariate time series data
Syntax
[A,SIG,E] = tsdata_to_var(X,p,regmode)
Arguments
See also Common variable names and data structures.
input
X multi-trial time series data p model order (number of lags) regmode regression mode: 'LWR' (default) or 'OLS'
output
A VAR coefficients matrix SIG residuals covariance matrix E residuals time series
Description
Returns VAR coefficients A and (optionally) residuals covariance matrix SIG and serially uncorrelated residuals E for the p-lag autoregression
(where = SIG) of a stationary multivariate process X. X may contain single- or multi-trial multivariate time series data. The regression mode is set by the regmode parameter, which may be 'LWR' (default) or 'OLS'. The former uses Morf's version of the LWR algorithm [1,2] while the latter calculates the OLS solution to the regression via QR decomposition.
Note: If the regressions are rank-deficient or ill-conditioned then A may be "bad" (i.e. will contain a NaN or Inf; see isbad) and/or warnings will may be issued. The caller should test for both these possibilities, by calls to isbad and warn_supp ... warn_test respectively. Possible causes are non-stationarity and/or colinearity in the data.
The caller should also, at the very least, check the spectral radius of the returned VAR coefficients (see var_specrad) to ensure that the coefficients define a stable VAR [1]. (This is calculated, along with other relevant information, in the routine var_to_autocov, which will typically be called subsequent to this function, and may be tested by a call to var_info).
References
[1] L. Barnett and A. K. Seth, The MVGC Multivariate Granger Causality Toolbox: A New Approach to Granger-causal Inference, J. Neurosci. Methods 223, 2014 [ preprint ].
[2] M. Morf, A. Viera, D. T. L. Lee and T. Kailath, "Recursive Multichannel Maximum Entropy Spectral Estimation", IEEE Trans. Geosci. Elec., 16(2), 1978.
See also
var_specrad | var_to_autocov | warn_supp | warn_test | isbad | var_info