我正在尝试使用rtf
和 community-contributed 命令estpost
将Spearman相关矩阵导出到esttab
或Excel文件中。
但是,出现以下错误:
invalid subcommand
r(198);
下面是我的代码:
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
答案 0 :(得分:3)
spearman
命令不能与estpost
一起使用,这就是Stata抱怨的原因。
以下对我有用:
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
---------------------------------------------------