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.89817 0.08904 0.16999 -0.01056 0.23780 0.40613 4
summary(residuals(mod, type = 'working'))
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NAs
#> -9.82016 1.09776 1.20481 -0.05372 1.31209 1.68388 4
