回归结果中不报告行业虚拟变量的系数
方法一:向内存中添加新的统计量 "estadd local"
要想在输出结果中增加一些内存中不存在的统计量,我们只需要预先采用手动的方式把这些统计量加入内存,随后再调出它并呈现在屏幕上即可。
例如,我们可以采用 estadd 命令向内存中添加两个统计量:
一个是文字类型的返回值——Industry,采用暂元 (local) 来存储;
另外一个是数值类型的返回值 ——Mean_Wage,采用单值 (scalar) 来存储:
sysuse "nlsw88.dta", clear
reg wage ttl_exp married
*-在内存中加入第一个返回值
estadd local Industry "Yes"
*-在内存中加入第二个返回值
qui sum wage
estadd scalar Mean_Wage = r(mean)
ereturn list //呈现内存中的返回值
具体命令:
sysuse "nlsw88.dta", clear
*-分组回归
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)
方法2: 使用 esttab 命令的 indicate() 选项
esttab 命令中有一个隐藏的选项 indicate(),在其帮助文件中是查不到的,但却能很好的解决我们这个例子中的需求。esttab命令中增加了如下选项:
indicate("行业效应 =.industry" "职业效应 =.occupation" )
其中,“"行业效应 =*.industry"’”的含义是,等号左侧是我们在屏幕上需要呈现的文字信息,而等号右侧则是虚拟变量的名称。
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 m "m1 m2 m3 m4" // 模型名称
local s "using Table03.rtf" // 输出到word文档
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" )

浙公网安备 33010602011771号