Stata - 如何让指示器变量指示器(是/否)出现在 esttab LaTeX 输出中

问题描述 投票:0回答:1

假设我使用这个数据集:

sysuse nlsw88, clear

我想运行回归并使用 esttab 将其保存到 .tex 文件。回归是这样的:

reg wage grade i.industry i.occupation, robust

重要的是,我想表明我正在使用行业和职业虚拟变量,但我不希望任何系数出现在表中。

做到这一点的一种方法是对行业和职业指标进行硬编码:

eststo clear
eststo: reg wage grade, robust
estadd local industry "No"
estadd local occupation "No"
eststo: reg wage grade i.industry i.occupation, robust
estadd local industry "Yes"
estadd local occupation "Yes"
esttab est* using "${path}/regress_wage.tex", r2 ar2 b(3) se label booktabs ///
    replace nodepvars nomtitles drop(*industry *occupation) ///
    scalars("industry Industry" "occupation Occupation") 

但我真的不想手动放入这些。我发现了指示

option
,但我无法让它与
i.
变量一起使用。我试过了:

eststo clear
eststo: reg wage grade, robust
eststo: reg wage grade i.industry i.occupation, robust
esttab est* using "${path}/regress_wage.tex", r2 ar2 b(3) se label booktabs ///
    replace nodepvars nomtitles drop(*industry *occupation) ///
    indicate(Industry = *industry*)

我也尝试将最后一行换成:

    indicate(Industry = _Iindustry*)
    indicate(Industry = industry*)  
    indicate(Industry = *industry)

但是没有任何作用。该怎么办?

此外,有没有办法让

Industry
Occupation
指标出现在常数正下方,而不是调整后的 R 平方下方?

label latex regression stata
1个回答
3
投票

您可以使用

coefl
选项查看系数的命名方式,这对于在
indicate()
中引用它们非常有用:

sysuse nlsw88, clear
reg wage grade i.industry i.occupation, robust coefl
esttab, indicate("Industry = *.industry" "Occupation = *.occupation")
esttab, indicate("Industry = *.industry" "Occupation = *.occupation", labels("In"))

最后一个命令将生成下表:

----------------------------
                      (1)   
                     wage   
----------------------------
grade               0.561***
                   (9.69)   

_cons               2.128   
                   (1.94)   

Industry               In   

Occupation             In   
----------------------------
N                    2226   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.