= Stata Correlate = '''`-correlate-`''' calculates [[Statistics/Correlation|correlations]]. See also [[Stata/PwCorr|-pwcorr-]]. <> ---- == Usage == To calculate the [[Statistics/Correlation|correlation]] matrix for some varlist, try: {{{ corr varlist matrix cor = r(C) }}} To calculate the [[Statistics/Covariance#Matrix|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 [[Stata/Weights|weights]], as it is not an estimation command. ---- == See also == [[https://www.stata.com/manuals/rcorrelate.pdf|Stata manual for -correlate-]] ---- CategoryRicottone