我正在尝试从Stata 社区贡献命令reghdfe
中将p值导出到Excel:
// get data
use "http://www.stata-press.com/data/r9/nlswork.dta", clear
xtset idcode year
// run regression
reghdfe ttl_exp age not_smsa msp nev_mar, abs(idcode year) cluster(idcode)
// store numbers
local rmse = `e(rmse)'
// export
putexcel A1 = (`rmse') using "export.xlsx" , modify // this works
如何获取导出到同一Excel文档的给定变量(例如msp
)的p值?
ereturn list
没有提供任何有用的信息,e(V)
仅包含协方差矩阵。
交叉发布的on Statalist。
答案 0 :(得分:2)
以下对我有用:
use "http://www.stata-press.com/data/r9/nlswork.dta", clear
xtset idcode year
reghdfe ttl_exp age not_smsa msp nev_mar, abs(idcode year) cluster(idcode)
------------------------------------------------------------------------------
| Robust
ttl_exp | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | -.008044 .0618821 -0.13 0.897 -.129366 .1132781
not_smsa | -.1616256 .0812134 -1.99 0.047 -.3208472 -.0024039
msp | -.004893 .0634814 -0.08 0.939 -.1293505 .1195645
nev_mar | -.36351 .0955207 -3.81 0.000 -.5507816 -.1762384
------------------------------------------------------------------------------
local pval = (2 * ttail(e(df_r), abs(_b[msp] / _se[msp]) ) )
display `pval'
.93856498
putexcel A1 = (`pval') using "export.xlsx", modify