{"id":1088,"date":"2018-08-12T15:55:16","date_gmt":"2018-08-12T19:55:16","guid":{"rendered":"http:\/\/www.kaikaichen.com\/?p=1088"},"modified":"2019-03-24T13:28:56","modified_gmt":"2019-03-24T17:28:56","slug":"handy-stata-command-to-display-combined-pearson-and-spearman-correlation-matrix","status":"publish","type":"post","link":"https:\/\/www.kaichen.work\/?p=1088","title":{"rendered":"Stata command to display combined Pearson and Spearman correlation matrix"},"content":{"rendered":"<p>Oftentimes we would like to display Pearson correlations below the diagonal and Spearman correlations above the diagonal. Two built-in commands, <code>pwcorr<\/code>\u00a0and <code>spearman<\/code>, 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.<\/p>\n<p>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 <a href=\"https:\/\/ideas.repec.org\/c\/boc\/bocode\/s457773.html\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p>A sample command is as follows:<\/p>\n<p>`corsp varlist, pw sig`<\/p>\n<p>To install Daniel&#8217;s module, type <code>ssc install corsp<\/code>\u00a0in Stata&#8217;s command window.<\/p>\n<p>A good technical comparison of Pearson and Spearman correlations can be found <a href=\"https:\/\/support.minitab.com\/en-us\/minitab-express\/1\/help-and-how-to\/modeling-statistics\/regression\/supporting-topics\/basics\/a-comparison-of-the-pearson-and-spearman-correlation-methods\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oftentimes we would like to display Pearson correlations below the diagonal and Spearman correlations above the diagonal. Two built-in commands, pwcorr\u00a0and spearman, can do the job. However, we have to manually combine Stata output tables when producing the correlation table &hellip; <a href=\"https:\/\/www.kaichen.work\/?p=1088\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts\/1088"}],"collection":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1088"}],"version-history":[{"count":8,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts\/1088\/revisions"}],"predecessor-version":[{"id":1196,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts\/1088\/revisions\/1196"}],"wp:attachment":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}