Learn R Programming

JSM (version 1.0.1)

fitted: Extract Fitted Values for Joint Models

Description

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

Usage

# S3 method for jmodelTM
fitted(object, process = c("Longitudinal", "Survival"), 
        type = c("Marginal", "Conditional"), …)
# S3 method for jmodelMult
fitted(object, process = c("Longitudinal", "Survival"), 
        type = c("Marginal", "Conditional"), …)

Arguments

object

an object inheriting from class jmodelTM or jmodelMult.

process

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

type

what type of fitted values to calculate for each process. See Details.

additional arguments required. None is used in this method.

Value

A numeric vector of fitted values.

Details

We have implemented the fitted value calculation for process = "Longitudinal" but not for process = "Survival" yet as they are not well defined under the joint modeling setting. There are two types of fitted values depending on whether to compute the values conditional on the random effects. With type = "Marginal", the fitted values are \(\mathbf{X}_i^\top(t)\boldsymbol\beta\) for objects returned by jmodelTM() and \(\mathbf{B}^\top(t)\boldsymbol\gamma\) for objects returned by jmodelMult(). With type = "Conditional", the fitted values are \(\mathbf{X}_i^\top(t)\boldsymbol\beta + \mathbf{Z}_i^\top(t)\mathbf{b}_i\) for objects returned by jmodelTM() and \(b_i\times\mathbf{B}^\top(t)\boldsymbol\gamma\) for objects returned by jmodelMult().

Examples

Run this code
# 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')

# fitted values for the longitudinal process
fitted(fitJT.ph, type = "Conditional")
# }

Run the code above in your browser using DataLab