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

如何在fixest包的etable中替换默认标准误注释?

问题

我需要将fixest包中etable()函数默认的标准误注释替换为自定义内容。当前使用的代码如下:

library(fixest)
model1 <- feols(mpg ~ hp + drat + wt|cyl, data=mtcars)

etable(model1, 
       signif.code = c("***"=0.001, "**"=0.01, "*"=0.05, "+"=0.1),
       style.tex = style.tex(var.title="", fixef.title="",
                             fixef.suffix=" FE", stats.title=""),
       tex = TRUE)   

默认生成的注释为:

Clustered (cyl) standard-errors in parentheses
我希望替换为:
括号内为稳健标准误

解决方案

在etable()中使用se.sub参数即可自定义标准误注释,修改后的代码如下:

library(fixest)
model1 <- feols(mpg ~ hp + drat + wt|cyl, data=mtcars)

etable(model1, 
       signif.code = c("***"=0.001, "**"=0.01, "*"=0.05, "+"=0.1),
       style.tex = style.tex(var.title="", fixef.title="",
                             fixef.suffix=" FE", stats.title=""),
       se.sub = "括号内为稳健标准误",  # 自定义标准误注释
       tex = TRUE)   

修改后生成的LaTeX输出示例:

\begingroup
\centering
\begin{tabular}{lc}
   \tabularnewline \midrule \midrule
   Dependent Variable: & mpg\\  
   Model:              & (1)\\  
   hp                  & -0.0261\\   
                       & (0.0136)\\   
   drat                & 0.8521\\   
                       & (0.7127)\\   
   wt                  & -2.980\\   
                       & (1.079)\\   
   cyl FE              & Yes\\  
   Observations        & 32\\  
   R$^2$               & 0.85938\\  
   Within R$^2$        & 0.47441\\  
   \midrule \midrule
   \multicolumn{2}{l}{\emph{括号内为稳健标准误}}\\
   \multicolumn{2}{l}{\emph{Signif. Codes: ***: 0.001, **: 0.01, *: 0.05, +: 0.1}}\\
\end{tabular}
\par\endgroup

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 09:01:01