Stata command to display combined Pearson and Spearman correlation matrix

Oftentimes we would like to display Pearson correlations below the diagonal and Spearman correlations above the diagonal. Two built-in commands, pwcorr and spearman, can do the job. However, we have to manually combine Stata output tables when producing the correlation table in the manuscript, which is time-consuming.

I find this fantastic module written by Daniel Klein. His command will return one table that combines Pearson and Spearman correlations and needs the fewest further edits. Thanks Daniel and please find his work here.

A sample command is as follows:

corsp varlist, pw sig

To install Daniel’s module, type ssc install corsp in Stata’s command window.

A good technical comparison of Pearson and Spearman correlations can be found here.

This entry was posted in Stata. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *