Max Weylandt.

← Back

Dropping interactions from modelsummary tables

18 January, 2024

Some code that might be helpful with factorial experiments, where you want to calculate all interactions but have a presentable table. Also here

 
co  <- ":"          # omit all interactions
co3 <- ":.*:"       # omit three way interactions and higher
co4 <- ":.*:.*:.*"  #omit four-way interactions

mod <- lm(mpg ~ hp*am*wt*cyl,data = mtcars)

modelsummary(mod, coef_omit = co )
modelsummary(mod, coef_omit = co3 )
modelsummary(mod, coef_omit = co4 )

← Back ↑ Top