Learn R Programming

insight (version 0.18.6)

is_mixed_model: Checks if a model is a mixed effects model

Description

Small helper that checks if a model is a mixed effects model, i.e. if it the model has random effects.

Usage

is_mixed_model(x)

Value

A logical, TRUE if x is a mixed model.

Arguments

x

A model object.

Examples

Run this code
data(mtcars)
model <- lm(mpg ~ wt + cyl + vs, data = mtcars)
is_mixed_model(model)

if (require("lme4")) {
  data(sleepstudy)
  model <- lmer(Reaction ~ Days + (1 | Subject), data = sleepstudy)
  is_mixed_model(model)
}

Run the code above in your browser using DataLab