COVLAG Function
computes autocovariance estimates
for a vector time series
- COVLAG(
,
)
The inputs to the COVLAG function are as follows:
![x](images/langref_langrefeq78.gif)
- is an
matrix of time series
values;
is the number of observations, and
is the dimension of the random vector.
![k](images/langref_langrefeq5.gif)
- 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 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 value returned by the COVLAG
function is an
![nv x (k*nv)](images/langref_langrefeq198.gif)
matrix.
The
![i](images/langref_langrefeq68.gif)
th
![nv x nv](images/langref_langrefeq199.gif)
block of the matrix is the sum
![\frac{1}n \sum_{j=i}^n x_j^' x_{j-i+1} {if } k\lt](images/langref_langrefeq200.gif)
where
![x_j](images/langref_langrefeq99.gif)
is the
![j](images/langref_langrefeq120.gif)
th row of
![x](images/langref_langrefeq78.gif)
.
If
![k](images/langref_langrefeq5.gif)
> 0, then the
![i](images/langref_langrefeq68.gif)
th
![nv x nv](images/langref_langrefeq199.gif)
block of the matrix is
![\frac{1}n \sum_{j=i}^n (x_j-\bar{x})^'(x_{j-i+1}-\bar{x})](images/langref_langrefeq201.gif)
where
![\bar{x}](images/langref_langrefeq202.gif)
is a row vector of the column means of
![x](images/langref_langrefeq78.gif)
.
For example, the following statements produce the matrix
![{cov}](images/langref_langrefeq203.gif)
, as shown:
x={-9,-7,-5,-3,-1,1,3,5,7,9};
cov=covlag(x,4);
COV 1 row 4 cols (numeric)
33 23.1 13.6 4.9
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.