Return the result of stats::terms() applied to the model or NULL if it is not possible to get terms from model.

model_get_terms(model)

# S3 method for default
model_get_terms(model)

# S3 method for brmsfit
model_get_terms(model)

# S3 method for glmmTMB
model_get_terms(model)

# S3 method for model_fit
model_get_terms(model)

# S3 method for betareg
model_get_terms(model)

Arguments

model

a model object

Details

For models fitted with glmmTMB::glmmTMB(), it will return a terms object taking into account all components ("cond" and "zi"). For a more restricted terms object, please refer to glmmTMB::terms.glmmTMB().

Examples

lm(hp ~ mpg + factor(cyl), mtcars) %>%
  model_get_terms()
#> hp ~ mpg + factor(cyl)
#> attr(,"variables")
#> list(hp, mpg, factor(cyl))
#> attr(,"factors")
#>             mpg factor(cyl)
#> hp            0           0
#> mpg           1           0
#> factor(cyl)   0           1
#> attr(,"term.labels")
#> [1] "mpg"         "factor(cyl)"
#> attr(,"order")
#> [1] 1 1
#> attr(,"intercept")
#> [1] 1
#> attr(,"response")
#> [1] 1
#> attr(,".Environment")
#> <environment: 0x560d9ce0f9c0>
#> attr(,"predvars")
#> list(hp, mpg, factor(cyl))
#> attr(,"dataClasses")
#>          hp         mpg factor(cyl) 
#>   "numeric"   "numeric"    "factor"