How to export Spearman correlations

为君一笑 提交于 2020-01-28 10:08:11

问题


I am trying to export the Spearman correlation matrix into an rtf or Excel file using estpost and the community-contributed command esttab.

However, I am getting the following error:

invalid subcommand
r(198);

Below is my code:

estpost spearman varlists, matrix stats(rho p) star(.05)
estimates store cl

esttab * using corrtable.rtf, b(%6.3f) label alignment(l) unstack not noobs compress replace

回答1:


The spearman command does not work with estpost, which is why Stata complains.

The following works for me:

sysuse auto, clear

spearman price mpg weight
matrix A = r(Rho)

esttab matrix(A, fmt(%5.2f)) using corrtable.rtf

---------------------------------------------------
                        A                          
                    price          mpg       weight
---------------------------------------------------
price                1.00        -0.54         0.49
mpg                 -0.54         1.00        -0.86
weight               0.49        -0.86         1.00
---------------------------------------------------


来源:https://stackoverflow.com/questions/57351327/how-to-export-spearman-correlations

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!