matrices: e(b) : 1 x 3 e(V) : 3 x 3 functions: ... ...
在上面的例子中,内存中的返回值包括四种类型,分别是:单值(scalars)、暂元(macros)、矩阵(matrices),以及函数(functions)。这些看似凌乱的返回值,都可以采用 esttab 等命令,以一种非常规整的方式重新呈现在屏幕上,或输出到 word 文档中。例如,当我们执行如下命令后,屏幕上会呈现如下结果:
. esttab, nogap scalar(N df_m F r2) ---------------------------- (1) wage ---------------------------- ttl_exp 0.330*** (12.95) married -0.291 (-1.19) _cons 3.823*** (9.99) ---------------------------- N 2246 df_m 2 F 85.79 r2 0.0711 ---------------------------- t statistics in parentheses * p<0.05, ** p<0.01, *** p<0.001
. sysuse "nlsw88.dta", clear . reg wage ttl_exp married *-在内存中加入第一个返回值 . estadd local Industry "Yes" *-在内存中加入第二个返回值 . qui sum wage . estadd scalar Mean_Wage = r(mean) . ereturn list //呈现内存中的返回值
*-分组回归 global xx "ttl_exp married south hours tenure age i.industry" reg wage $xx if race==1 estadd local Industry "Yes" //向内存中添加新的统计量, help estadd estadd local Occupation "No" est store m1 reg wage $xx if race==2 estadd local Industry "Yes" estadd local Occupation "No" est store m2 reg wage $xx i.occupation if race==1 estadd local Industry "Yes" estadd local Occupation "Yes" est store m3 reg wage $xx i.occupation if race==2 estadd local Industry "Yes" estadd local Occupation "Yes" est store m4
*-结果呈现 local s "using Table03.rtf" // 输出到word文档 local m "m1 m2 m3 m4" // 模型名称 local mt "White Black White Black" //模型标题 esttab `m', mtitle(`mt') b(%6.3f) nogap compress /// star(* 0.1 ** 0.05 *** 0.01) /// drop(*.industry *.occupation) /// ar2 scalar(N Industry Occupation)
clear all sysuse "nlsw88.dta", clear *-分组回归 global xx "ttl_exp married south hours tenure age i.industry" reg wage $xx if race==1 est store m1 reg wage $xx if race==2 est store m2 reg wage $xx i.occupation if race==1 est store m3 reg wage $xx i.occupation if race==2 est store m4 *-输出结果 local s "using Table03.rtf" // 输出到word文档 local m "m1 m2 m3 m4" // 模型名称 local mt "White Black White Black" //模型标题 esttab `m' `s', mtitle(`mt') b(%6.3f) nogap compress /// star(* 0.1 ** 0.05 *** 0.01) /// ar2 scalar(N) replace /// indicate("行业效应 =*.industry" "职业效应 =*.occupation" )