Purpose
Computes sample covariance or correlation matrices for a group of variables.
Syntax
COVA vlist { ; WEIGHT vname }
@
CORR vlist { ; WEIGHT vname } @
Arguments and Subcommands
vlist
Names of up to 10 variables for which the covariance or correlation matrix is to be computed.
; WEIGHT vname
The weight variable for the computations. If the WEIGHT subcommand is used, vlist should be terminated with a semicolon. WGT can be used in place of WEIGHT if desired.
Remarks
In order to obtain meaningful results when working with tables, it is important to include a variable that contains the number of individuals in each cell as a weight variable.
Examples
a) To compute the covariance matrix for variables called age, height, and wgt. (This command would produce the correct result in a data set composed of records for individuals.)
COVA age height wgt @
b) To compute the correlation matrix for variables called age, height, and wgt in a table in which the fatrisk variable contains a count of the number of people in each cell.
CORR age height wgt; WEIGHT fatrisk @