Learn R Programming

insight (version 0.19.11)

has_intercept: Checks if model has an intercept

Description

Checks if model has an intercept.

Usage

has_intercept(x, verbose = TRUE)

Value

TRUE if x has an intercept, FALSE otherwise.

Arguments

x

A model object.

verbose

Toggle warnings.

Examples

Run this code
model <- lm(mpg ~ 0 + gear, data = mtcars)
has_intercept(model)

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

model <- lmer(Reaction ~ 0 + Days + (Days | Subject), data = sleepstudy)
has_intercept(model)

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

Run the code above in your browser using DataLab