Dataplot Vol 2 Vol 1

# SET MATRIX <CORRELATION/COVARIANCE> DIRECTION

Name:
SET MATRIX <CORRELATION/COVARIANCE> DIRECTION
Type:
Set Subcommand
Purpose:
Specify whether correlation (or covariance) matrices are computed based on column-wise or row-wise correlations (covariances).
Description:
Given a nxp matrix, the CORRELATION MATRIX command computes all the column-wise correlations. This results in a kxk correlation matrix.

There may be situations in which you are interested in the row-wise correlations (which results in a nxn correlation matrix). This command allows you to specify which of these cases to compute.

Syntax 1:
SET MATRIX CORRELATION DIRECTION <COLUMN/ROW> where COLUMN specifies subsequent correlation matrices will be based on column-wise correlations and ROW specifies they will be based on row-wise correlations.

This syntax is used to specify the column/row direction for subsequent correlation matrices.

Syntax 2:
SET MATRIX COVARIANCE DIRECTION <COLUMN/ROW> where COLUMN specifies subsequent covariance matrices will be based on column-wise covariances and ROW specifies they will be based on row-wise covariances.

This syntax is used to specify the column/row direction for subsequent covariance matrices.

Examples:
SET MATRIX CORRELATION DIRECTION ROW
SET MATRIX CORRELATION DIRECTION COLUMN
SET MATRIX COVARIANCE DIRECTION ROW
SET MATRIX COVARIANCE DIRECTION COLUMN
Default:
Correlation and covariance matrices are computed column-wise.
Synonyms:
None
Related Commands:
 CORRELATION MATRIX = Compute the correlation matrix of a matrix. COVARIANCE MATRIX = Compute the covariance matrix of a matrix.
Applications:
Multivariate Analysis
Implementation Date:
2004/11
Program:
```
DIMENSION 100 COLUMNS
-6.07 -4.83 -5.15 -5.96 -4.61 -4.35 -4.21 -5.71 -4.54 -3.26
-0.04 -0.72 -0.25 -1.56 -0.21 -0.79 -0.02 -1.42 -0.01 -1.47
4.79  5.76  5.47  4.19  5.08  5.70  6.10  3.99  4.64  4.31
END OF DATA
SET MATRIX CORRELATION DIRECTION ROW
LET CORR = CORRELATION MATRIX C
SET WRITE FORMAT 3F6.2
PRINT CORR
```
This results in the following output:
```
1.00  0.03  0.31
0.03  1.00  0.59
0.31  0.59  1.00
```

Date created: 12/12/2005
Last updated: 12/12/2005