1

When using texreg I frequently use omit.coef to remove certain estimates (for fixed effects) as below.

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

In my lm model if I use multiple fixed effects how can I omit multiple variables? For example, I have two types of fixed effects - STORE_ID and Year, let's say.

This does not work.

screenreg(lm01,omit.coef=c('STORE_ID','Year'),custom.model.names = c("AA"))
John legend2
  • 840
  • 9
  • 18

2 Answers2

1

You'd have to consider regex instead, separated by an |. Example:

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

Now omitting:

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
jay.sf
  • 60,139
  • 8
  • 53
  • 110
1

screenreg allows you to include the custom.coef.map option and pass a list through it. This option allows you to directly select the variables you want to KEEP (instead of omit with omit.coef), and allows you to change the variables' names simultaneously:

screenreg(lm01, custom.coef.map = list("var1" = "First variable",
"var2" = "Second Variable", "var3" = "Third variable"))