Skip to contents

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

Usage

model_get_terms(model)

# Default S3 method
model_get_terms(model)

# S3 method for class 'brmsfit'
model_get_terms(model)

# S3 method for class 'glmmTMB'
model_get_terms(model)

# S3 method for class 'model_fit'
model_get_terms(model)

# S3 method for class 'betareg'
model_get_terms(model)

# S3 method for class 'betareg'
model_get_terms(model)

Arguments

model

(a model object, e.g. glm)
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: 0x561102a88270>
#> attr(,"predvars")
#> list(hp, mpg, factor(cyl))
#> attr(,"dataClasses")
#>          hp         mpg factor(cyl) 
#>   "numeric"   "numeric"    "factor"