The COVLAG function computes a sequence of lagged crossproduct matrices. This function is useful for computing sample autocovariance sequences for scalar or vector time series.
The arguments to the COVLAG function are as follows:
is an matrix of time series values; is the number of observations, and is the dimension of the random vector.
is a scalar, the absolute value of which specifies the number of lags desired. If is positive, a mean correction is made. If is negative, no mean correction is made.
The value returned by the COVLAG function is an matrix. The th block of the matrix is the sum
where is the th row of . If > 0, then the th block of the matrix is
where is a row vector of the column means of .
For example, the following statements produce a lagged crossproduct matrix:
x = T(do(-9, 9, 2)); cov = covlag(x, 4); print cov;