C_Hut
C_Hut

Reputation: 31

In R: tab_model (hide polynomials)

is there any way to hide the quadratic/polynomial terms in the regression output? It seems to show them by default which adds tons of rows, obviously. Thanks so much! Best Clemens

Upvotes: 0

Views: 268

Answers (1)

C_Hut
C_Hut

Reputation: 31

The developer answered this elsewhere:

https://github.com/strengejacke/sjPlot/issues/776#issuecomment-944883019

The next update will include keep and drop arguments, that are a bit more flexible and allow you to define regular expression patterns like this:

library(sjPlot)

# load mtcars data
data(mtcars)

# factorize cyl variable
mtcars$cyl.f <- factor(mtcars$cyl, ordered=TRUE)

# set polynomial contrast for factorized cyl
contrasts(mtcars$cyl.f) = contr.poly(3)

# run linear regression model
m <- lm(mpg ~ cyl.f, data=mtcars)

# include all polynomials
tab_model(m, keep ="\\.f")

# remove all polynomials
tab_model(m, drop ="\\.f")

Upvotes: 2

Related Questions