help cpcorr

Title

cpcorr -- Correlations for each row vs each column variable

Syntax

cpcorr
rowvarlist
\
colvarlist
[weight]
[if] [in]
[
,
covariance
square
matrix(matname)
matlist_options
]

cpcorr
varlist
[weight]
[if] [in]
[
,
covariance
square
matrix(matname)
matlist_options
]

Description

cpcorr produces a matrix of correlations for rowvarlist
versus colvarlist (first syntax) or for varlist (second
syntax). With the first syntax, the matrix may thus be oblong, and need
not be square. With the second syntax, the matrix is square.

The stub cp is derived from Cartesian product; it may also be
interpreted as "cross pairs".

The backslash \ must be used to separate the rowvarlist and
the colvarlist in the first syntax.

Options

covariance specifies calculation of the covariance.

square specifies squaring of correlations.

matrix(matname) specifies that the matrix produced be saved as
matrix matname.

matlist_options are options of matrix list. The default
includes format(%5.4f).

Examples

. sysuse auto, clear

. cpcorr mpg-foreign \ price

. cpcorr mpg-foreign, f(%4.2f)

Author

Nicholas J. Cox, Durham University, U.K.

n.j.cox@durham.ac.uk

Acknowledgments

Torsten Neilands helpfully reported a bug.

Saved results

r(N) number of observations
r(C) matrix of correlations or covariances
r(p) matrix of P-values

Also see

Official commands:

[R] correlate Correlations and
covariances

[G-2] graph matrix Scatter plot
matrices

User-written commands (if installed):

corrci Correlations with confidence intervals

corrtable Correlation matrix as graphical table

cpspear Spearman correlations for row and column variables

crossplot Twoway plots for each y vs each x variable