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"))
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