Skip to contents

List higher order variables of a model

Usage

model_list_higher_order_variables(model)

# Default S3 method
model_list_higher_order_variables(model)

Arguments

model

(a model object, e.g. glm)
A model object.

Examples

lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) |>
  model_list_higher_order_variables()
#> [1] "mpg"         "factor(cyl)" "hp:disp"    

mod <- glm(
  response ~ stage * grade + trt:stage,
  gtsummary::trial,
  family = binomial
)
mod |> model_list_higher_order_variables()
#> [1] "stage:grade" "stage:trt"  

mod <- glm(
  Survived ~ Class * Age + Sex,
  data = Titanic |> as.data.frame(),
  weights = Freq,
  family = binomial
)
mod |> model_list_higher_order_variables()
#> [1] "Sex"       "Class:Age"