## 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β^, whereas for type = "Subject" they are Xβ^+Zb^, where β^
and 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".
Returns
a numeric vector of fitted values or residuals.
References
Rizopoulos, D. (2012) Joint Models for Longitudinal and Time-to-Event Data: with Applications in R. Boca Raton: Chapman and Hall/CRC.
## 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)