Extract residuals from an object of class JointAI
Arguments
- object
object inheriting from class 'JointAI'
- type
type of residuals:
"working"(default),"pearson"or"response". In models with more than one model formula, one value applies to all outcomes, and a named vector sets the type per outcome (outcomes that are not named get"working").- warn
logical; should warnings be given? Default is
TRUE.- ...
currently not used
Value
A numeric vector of residuals, or, for models with more than one model formula, a list with one such vector per outcome.
Note
Residuals are currently only available for generalized linear (mixed) models, including log-normal and beta models (for beta models only
type = "response"). For other model types (ordinal, multinomial, survival and joint models),residuals()gives an error.For mixed models residuals are calculated using the fixed effects only.
Examples
mod <- glm_imp(B1 ~ C1 + C2 + O1, data = wideDF, n.iter = 100,
family = binomial(), mess = FALSE)
summary(residuals(mod, type = 'response'))
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NAs
#> -0.908715 0.076955 0.162274 -0.008339 0.248156 0.424583 4
summary(residuals(mod, type = 'working'))
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NAs
#> -10.95465 1.08338 1.19371 -0.05455 1.33012 1.73787 4
