is_nullmodel: Checks if model is a null-model (intercept-only)

View source: R/is_nullmodel.R

is_nullmodelR Documentation

Checks if model is a null-model (intercept-only)

Description

Checks if model is a null-model (intercept-only), i.e. if the conditional part of the model has no predictors.

Usage

is_nullmodel(x)

Arguments

x

A model object.

Value

TRUE if x is a null-model, FALSE otherwise.

Examples


model <- lm(mpg ~ 1, data = mtcars)
is_nullmodel(model)

model <- lm(mpg ~ gear, data = mtcars)
is_nullmodel(model)

data(sleepstudy, package = "lme4")
model <- lme4::lmer(Reaction ~ 1 + (Days | Subject), data = sleepstudy)
is_nullmodel(model)

model <- lme4::lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy)
is_nullmodel(model)


insight documentation built on Nov. 26, 2023, 5:08 p.m.