You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Stata使用esttab导出LaTeX回归表时如何将make整行结果设为粗体

解决方案

你可以直接通过esttab自带的pattern参数实现特定变量行的整体加粗,不需要修改原有回归逻辑,修改后的可运行代码如下:

sysuse auto, clear
label var make "Make"
eststo clear
eststo: reghdfe price make mpg rep trunk, abs(foreign)
eststo: reghdfe price make mpg rep , abs(foreign)       
* pattern参数中@为占位符,对应原单元格的所有输出内容(系数、星号、p值等)
esttab using "test.tex", replace p ar2 star(* 0.10 ** 0.05 *** 0.01) pattern(make "\textbf{@}" *)

如果需要变量名「Make」也同步加粗,保留你原有label var make "\textbf{Make}"的设置即可。

如果只需要将「make」对应的点估计值加粗,保留同行的p值/标准误不加粗,可以用cells参数自定义单元格格式:

esttab using "test.tex", replace ar2 star(* 0.10 ** 0.05 *** 0.01) ///
cells("b(fmt(3) pattern(make \textbf{%9.3f} *))" "p(fmt(3) par)")

两种方案生成的tex文件无需二次修改即可直接编译,和你原有输出的其余格式完全一致。


内容的提问来源于stack exchange,提问作者safex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.03 04:39:04