Differences between revisions 3 and 4
Revision 3 as of 2025-10-24 16:53:15
Size: 852
Comment: Rewrite
Revision 4 as of 2026-08-11 21:25:05
Size: 843
Comment: Relink
Deletions are marked like this. Additions are marked like this.
Line 22: Line 22:
To calculate the [[Statistics/Covariance#Matrix|covariance matrix]], try: To calculate the [[Analysis/Covariance|covariance matrix]], try:

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 2026-08-11 21:25:05 by DominicRicottone)