fitted: Fitted Values and Residuals for Joint Models In JMbayes: Joint Modeling of Longitudinal and Time-to-Event Data under a Bayesian Approach

Description

Calculates fitted values for joint models.

Usage

  1 2 3 4 5 6 7 8 9 10 11 ## S3 method for class 'JMbayes' fitted(object, process = c("Longitudinal", "longitudinal", "Event", "event"), type = c("Marginal", "marginal", "Subject", "subject"), nullY = FALSE, ...) ## S3 method for class 'JMbayes' residuals(object, process = c("Longitudinal", "longitudinal", "Event", "event"), type = c("Marginal", "marginal", "Subject", "subject", "Martingale", "martingale", "nullMartingale", "nullmartingale"), standardized = FALSE, ...) 

Arguments

 object an object inheriting from class jointModel. process for which model (i.e., linear mixed model or survival model) to calculate fitted values or residuals. type what type of fitted values or residuals to calculate. See Details. nullY logical; if TRUE the association parameters that connect the longitudinal and event time process are set to zero. standardized logical; if TRUE standardized residuals are calculated. ... additional arguments; currently none is used.

Details

For process = "Longitudinal", let X denote the design matrix for the fixed effects β, and Z the design matrix for the random effects b. Then for type = "Marginal" the fitted values are X \hat{β}, whereas for type = "Subject" they are X \hat{β} + Z \hat{b}, where \hat{β} and \hat{b} denote the corresponding posterior means for the fixed and random effects. The corresponding residuals are calculated by subtracting the fitted values from the observed data y. If type = "Subject" and standardized = TRUE, the residuals are divided by the estimated residual standard error.

For process = "Event" function fitted() calculates the cumulative hazard function at each time point a longitudinal measurement has been recorded. If nullY = TRUE, then the cumulative hazard is calculated without the contribution of the longitudinal process. Function residuals() calculates the martingales residuals or the martingale residuals without the contribution of the longitudinal process when type = "nullMartingale".

Value

a numeric vector of fitted values or residuals.

Author(s)

Dimitris Rizopoulos [email protected]

References

Rizopoulos, D. (2012) Joint Models for Longitudinal and Time-to-Event Data: with Applications in R. Boca Raton: Chapman and Hall/CRC.

Examples

  1 2 3 4 5 6 7 8 9 10 ## Not run: lmeFit <- lme(log(serBilir) ~ ns(year, 2), data = pbc2, random = ~ ns(year, 2) | id) survFit <- coxph(Surv(years, status2) ~ 1, data = pbc2.id, x = TRUE) jointFit <- jointModelBayes(lmeFit, survFit, timeVar = "year") fitted(jointFit, process = "Event") residuals(jointFit, type = "Subject", standardized = TRUE) ## End(Not run) 

JMbayes documentation built on Nov. 17, 2017, 5:20 a.m.