RATS 10.1
RATS 10.1

VCV( options )   start end

# list of series of residuals

 

Computes a covariance/correlation matrix of a set of series (usually residuals because mean of zero is assumed). Use CMOMENT with the CORR option for computing a more general correlation matrix.

Wizard

You can use the Statistics—Covariance Matrix Wizard to compute a covariance matrix. If you are viewing a Series Window, you can use the View—Covariance Matrix operation or  toolbar icon to compute a covariance matrix for a series selected in the series window.

Parameters

start,end

range for estimation. Defaults to the maximum range of all series involved.

Options

[PRINT]/NOPRINT

Print covariance/correlation matrix

 

WINDOW="Title for window" [unused]

The WINDOW option will create a (read-only) Report Window showing the output.

 

CENTERED/[NOCENTERED]

Use CENTERED to subtract means out of the input series.

 

MATRIX=(output) SYMMETRIC matrix [unused]

Save the computed VCV matrix in the specified array

 

SMPL=Standard SMPL option [unused]

SPREAD=Standard SPREAD option [unused]

WEIGHT=Standard WEIGHT option [unused]

SHUFFLE=SERIES[INTEGER] with entry remapping[unused]


Technical Information

VCV will, in general, give the same result as the SIGMA options on instructions such as ESTIMATE, NLSYSTEM and SUR if applied to the residuals from those. If \({u_t}\) is the column vector of the group of series at time t, then the estimate is

 

\(\bf{\hat \Sigma } = \frac{1}{T}\sum\limits_{t = 1}^T {{u_t}{u_t}^\prime } \)

 

Note the use of the T divisor, without adjustment for “degrees of freedom.” The T divisor gives the maximum likelihood estimator (in general), and will thus give a matrix which can be used in further likelihood-based analysis, such as testing and restricted modeling.

 

VCV will, in general, give a different result than instructions or functions which remove the means in the course of their calculations (examples are the function %COV, and the CMOM instruction when used with the CENTER or CORR options).

 

Also, because the standard errors of estimate in regression outputs are corrected for degrees of freedom, there will also be a scale factor difference between the SEESQ’s in the output and the diagonal elements produced by VCV.

Missing Values

Any observation which has a missing value for any of the series will be dropped from the calculation.

Variables Defined

%SIGMA

covariance matrix (SYMMETRIC)

%LOGDET

log determinant of the matrix (REAL)

%NOBS

number of observations (INTEGER)

%NVAR

number of variables (INTEGER)

%MEANV

VECTOR of means of the variables (with CENTER option only)

Examples

Computes the covariance matrix of the three series XJPN, XFRA and XSUI and computes QBAR as the correlation matrix. (%SIGMA and the MATRIX option both give covariance matrices). Since NOCENTER is the default, this uses CENTER to take the means out of the data.
 

vcv(center)

# xjpn xfra xsui

compute qbar=%cvtocorr(%sigma)


 

This computes the covariance matrix of the VECT[SERIES] called ULIST and saves it into the matrix V.
 

vcv(noprint,matrix=v) startl endl

# ulist

Sample Output

This is the output from the first example. This is a covariance\correlation matrix with variances and covariances on and below the diagonal and correlations above the diagonal.

 

Covariance\Correlation Matrix

        XJPN        XFRA        XSUI

XJPN 0.398829261     0.55994     0.56526

XFRA 0.230897587 0.426359710     0.82230

XSUI 0.273707444 0.411684556 0.587880308

 


Copyright © 2025 Thomas A. Doan