residuals {JM} | R Documentation |
Calculates residuals for joint models.
## S3 method for class 'jointModel': residuals(object, process = c("Longitudinal", "Event"), type = c("Marginal", "Subject", "stand-Marginal", "stand-Subject"), ...)
object |
an object inheriting from class jointModel . |
process |
for which model (i.e., linear mixed model or survival model) to calculate residuals. |
type |
what type of residuals to calculate. See Details. |
... |
additional arguments; currently none is used. |
Currently residuals are calculated for the longitudinal outcome. If type = "Marginal"
these are
e_{ij} = y_{ij} - x_{ij}^T hat{β}, whereas for type = "Subject"
, e_{ij} = y_{ij}
- x_{ij}^T hat{β} - z_{ij}^T b_i, where i denotes the subject and j the measurement,
y_{ij} the longitudinal responses, x_{ij}^T and z_{ij}^T the corresponding rows of the
fixed and random effects design matrices, respectively, and β and b_i denote the fixed effects
and random effects components.
If type = "stand-Marginal"
or type = "stand-Subject"
, the above defined residuals are divided by
the estimated standard deviation of the error term.
a numeric vector of residual values.
Residuals are not currently computed for the survival outcome.
Dimitris Rizopoulos dimitris.rizopoulos@med.kuleuven.be
# linear mixed model fit fitLME <- lme(sqrt(CD4) ~ obstime * drug - drug, random = ~ 1 | patient, data = aids) # cox model fit fitCOX <- coxph(Surv(Time, death) ~ drug, data = aids.id, x = TRUE) # joint model fit, under the additive log cumulative hazard model fitJOINT <- jointModel(fitLME, fitCOX, timeVar = "obstime", method = "ch-GH") head(cbind( "Marginal" = residuals(fitJOINT), "std-Marginal" = residuals(fitJOINT, type = "stand-Marginal"), "Subject" = residuals(fitJOINT, type = "Subject"), "std-Subject" = residuals(fitJOINT, type = "stand-Subject") ))