Stata Correlate

-correlate- calculates correlations.

See also -pwcorr-.


Usage

To calculate the correlation matrix for some varlist, try:

corr varlist
matrix cor = r(C)

To calculate the covariance matrix, try:

corr varlist, covariance
matrix cov = r(C)

To calculate the precision matrix, follow-up the above with:

matrix invcov = invsym(cov)  //note that invsym() is preferred over inv()

Note that this command does not support weights, as it is not an estimation command.


See also

Stata manual for -correlate-


CategoryRicottone

Stata/Correlate (last edited 2025-10-24 16:53:15 by DominicRicottone)