Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

residuals

Extract Residuals for Joint Models


Description

residuals is a generic function which extracts residuals from objects returned by jmodelTM() or jmodelMult().

Usage

## S3 method for class 'jmodelTM'
residuals(object, process = c("Longitudinal", "Survival"), 
            type = c("Marginal", "Conditional", "Standardized-Marginal", 
            "Standardized-Conditional"), ...)
## S3 method for class 'jmodelMult'
residuals(object, process = c("Longitudinal", "Survival"), 
            type = c("Marginal", "Conditional", "Standardized-Marginal", 
            "Standardized-Conditional"), ...)

Arguments

object

an object inheriting from class jmodelTM or jmodelMult.

process

for which process the residuals are calculated, i.e. the longitudinal or the survival process.

type

what type of residuals to calculate for each process. See Details.

...

additional arguments required. None is used in this method.

Details

We have implemented the residual calculation for process = "Longitudinal" but not for process = "Survival" yet as they are not well defined under the joint modeling setting. There are four types of residuals depending on whether to compute the values conditional on the random effects and whether to standardize the residuals. Please refer to Nobre and Single (2007) for details.

With type = "Marginal", the residuals are \varepsilon_{ij} = Y_{ij} - \mathbf{X}_{ij}^\top\boldsymbolβ for objects returned by jmodelTM() and \varepsilon_{ij} = Y_{ij} - \mathbf{B}^\top(t_{ij})\boldsymbolγ for objects returned by jmodelMult(). With type = "Conditional", the residuals are \varepsilon_{ij} = Y_{ij} - \mathbf{X}_{ij}^\top\boldsymbolβ - \mathbf{Z}_{ij}^\top\mathbf{b}_i for objects returned by jmodelTM() and \varepsilon_{ij} = Y_{ij} - b_i\times\mathbf{B}^\top(t_{ij})\boldsymbolγ for objects returned by jmodelMult(). If type = "Standardized-Marginal" or type = "Standardized-Conditional", the above defined residuals are divided by the estimated standard deviation of the corresponding error term.

Value

A numerc vector of residual values.

Author(s)

References

Nobre, J. S. and Singer, J. M. (2007) Residuals analysis for linear mixed models. Biometrical Jounral 49(6), 863–875.

See Also

Examples

## Not run: 
fitLME <- lme(proth ~ Trt * obstime, random = ~ 1 | ID, data = liver)
fitCOX <- coxph(Surv(start, stop, event) ~ Trt, data = liver, x = TRUE)
fitJT.ph <- jmodelTM(fitLME, fitCOX, liver, timeVarY = 'obstime')

# residuals for the longitudinal process
residuals(fitJT.ph, type = "Standardized-Conditional")

## End(Not run)

JSM

Semiparametric Joint Modeling of Survival and Longitudinal Data

v1.0.1
BSD_3_clause + file LICENSE
Authors
Cong Xu, Pantelis Z. Hadjipantelis and Jane-Ling Wang
Initial release
2020-07-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.