Learn R Programming

insight (version 0.17.0)

get_residuals: Extract model residuals

Description

Returns the residuals from regression models.

Usage

get_residuals(x, ...)

# S3 method for default get_residuals(x, weighted = FALSE, verbose = TRUE, ...)

Arguments

x

A model.

...

Passed down to residuals(), if possible.

weighted

Logical, if TRUE, returns weighted residuals.

verbose

Toggle warnings and messages.

Value

The residuals, or NULL if this information could not be accessed.

Examples

Run this code
# NOT RUN {
data(mtcars)
m <- lm(mpg ~ wt + cyl + vs, data = mtcars)
get_residuals(m)

m <- glm(vs ~ wt + cyl + mpg, data = mtcars, family = binomial())
get_residuals(m) # type = "deviance" by default
get_residuals(m, type = "response")
# }

Run the code above in your browser using DataLab