View source: R/get_residuals.R
get_residuals | R Documentation |
Returns the residuals from regression models.
get_residuals(x, ...)
## Default S3 method:
get_residuals(x, weighted = FALSE, verbose = TRUE, ...)
x |
A model. |
... |
Passed down to |
weighted |
Logical, if |
verbose |
Toggle warnings and messages. |
The residuals, or NULL
if this information could not be
accessed.
This function returns the default type of residuals, i.e. for the
response from linear models, the deviance residuals for models of class
glm
etc. To access different types, pass down the type
argument (see
'Examples').
This function is a robust alternative to residuals()
, as it works for
some special model objects that otherwise do not respond properly to calling
residuals()
.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.