File: get_residuals.Rd

package info (click to toggle)
r-cran-insight 0.19.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,308 kB
  • sloc: sh: 13; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,372 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_residuals.R
\name{get_residuals}
\alias{get_residuals}
\alias{get_residuals.default}
\title{Extract model residuals}
\usage{
get_residuals(x, ...)

\method{get_residuals}{default}(x, weighted = FALSE, verbose = TRUE, ...)
}
\arguments{
\item{x}{A model.}

\item{...}{Passed down to \code{residuals()}, if possible.}

\item{weighted}{Logical, if \code{TRUE}, returns weighted residuals.}

\item{verbose}{Toggle warnings and messages.}
}
\value{
The residuals, or \code{NULL} if this information could not be
accessed.
}
\description{
Returns the residuals from regression models.
}
\note{
This function returns the default type of residuals, i.e. for the
response from linear models, the deviance residuals for models of class
\code{glm} etc. To access different types, pass down the \code{type}
argument (see 'Examples').
\cr \cr
This function is a robust alternative to \code{residuals()}, as it works for
some special model objects that otherwise do not respond properly to calling
\code{residuals()}.
}
\examples{
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")
}