【问题标题】:Omit multiple factors in texreg在 texreg 中省略多个因素
【发布时间】:2020-08-09 05:13:14
【问题描述】:

在使用texreg 时,我经常使用omit.coef 来删除某些估计值(对于固定效应),如下所示。

screenreg(lm01,omit.coef='STORE_ID',custom.model.names = c("AA"))

在我的lm 模型中,如果我使用多个固定效应,如何省略多个变量?例如,我有两种类型的固定效果 - STORE_ID 和 Year,比方说。

这不起作用。

screenreg(lm01,omit.coef=c('STORE_ID','Year'),custom.model.names = c("AA"))

【问题讨论】:

    标签: r texreg


    【解决方案1】:

    您必须改用正则表达式,用| 分隔。 例子:

    fit <- lm(mpg ~ cyl + disp + hp + drat, mtcars)
    texreg::screenreg(fit)
    # =====================
    #              Model 1 
    # ---------------------
    # (Intercept)  23.99 **
    #              (7.99)  
    # cyl          -0.81   
    #              (0.84)  
    # disp         -0.01   
    #              (0.01)  
    # hp           -0.02   
    #              (0.02)  
    # drat          2.15   
    #              (1.60)  
    # ---------------------
    # R^2           0.78   
    # Adj. R^2      0.75   
    # Num. obs.    32      
    # =====================
    # *** p < 0.001; ** p < 0.01; * p < 0.05
    

    现在省略:

    texreg::screenreg(fit, omit.coef=c('disp|hp|drat'))
    # =====================
    #              Model 1 
    # ---------------------
    # (Intercept)  23.99 **
    #              (7.99)  
    # cyl          -0.81   
    #              (0.84)  
    # ---------------------
    # R^2           0.78   
    # Adj. R^2      0.75   
    # Num. obs.    32      
    # =====================
    # *** p < 0.001; ** p < 0.01; * p < 0.05
    

    【讨论】:

      猜你喜欢
      • 2017-08-18
      • 1970-01-01
      • 2010-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-01
      • 2019-04-06
      • 1970-01-01
      相关资源
      最近更新 更多