tsdata_to_autocov
Calculate sample autocovariance sequence from time series data
Syntax
G = tsdata_to_autocov(X,q)
Arguments
See also Common variable names and data structures.
input
X multi-trial time series data q number of lags
output
G sample autocovariance sequence
Description
Returns q-lag sample autocovariance sequence G defined as for the (presumed stationary) multivariate process X. X may contain single- or multi-trial time series data.
Note 1: This routine is discouraged for VAR numerical modelling, and is only included for completeness; sample autocovariances are notoriously noisy and biased (but see the experimental tsdata_to_autocov_debias). The recommended practice is to estimate a VAR model via tsdata_to_var and then calculate autocovariance via var_to_autocov.
Note 2: For multi-trial data we don't calculate autocovariance on a per-trial basis, since this doesn't really make sense... trials in multi-trial data must be assumed to be from the same distribution. If you feel you absolutely have to calculate per-trial autocovariance (not recommended), call this function for each trial series X(:,:,r) and average the results over trials. Alternatively, if you feel you have to at least demean per-trial (not recommended), call demean for each trial series X(:,:,r) before calling this routine.
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 ].
See also
demean | tsdata_to_var | var_to_autocov | tsdata_to_autocov_debias