fitted {JM} | R Documentation |
Fitted Values for Joint Models
Description
Calculates fitted values for joint models.
Usage
## S3 method for class 'jointModel'
fitted(object, process = c("Longitudinal", "Event"),
type = c("Marginal", "Subject", "EventTime", "Slope"), scale = c("survival",
"cumulative-Hazard", "log-cumulative-Hazard"), M = 200, ...)
Arguments
object |
an object inheriting from class |
process |
for which model (i.e., linear mixed model or survival model) to calculate the fitted values. |
type |
what type of fitted values to calculate for the survival outcome. See Details. |
scale |
in which scale to calculate; relevant only when |
M |
how many times to simulate random effects; see Details for more info. |
... |
additional arguments; currently none is used. |
Details
For process = "Longitudinal"
, let X
denote the design matrix for the fixed effects \beta
, and
Z
the design matrix for the random effects b
. Then for type = "Marginal"
the fitted values are
X \hat{\beta},
whereas for type = "Subject"
they are X \hat{\beta} + Z \hat{b}
. For type = "EventTime"
is the same as type = "Subject"
but evaluated at the observed event times. Finally, type == "Slope"
returns Xs \hat{\beta} + Zs \hat{b}
where Xs
and Zs
denote the fixed- and random-effects design
matrices corresponding to the slope term which is specified in the derivForm
argument of jointModel
.
For process = "Event"
and type = "Subject"
the linear predictor conditional on the random effects
estimates is calculated for each sample unit. Depending on the value of the scale
argument the fitted survival
function, cumulative hazard function or log cumulative hazard function is returned. For type = "Marginal"
,
random effects values for each sample unit are simulated M
times from a normal distribution with zero mean and
covariance matrix the estimated covariance matrix for the random effects. The marginal survival function for the
i
th sample unit is approximated by
S_i(t) = \int S_i(t | b_i) p(b_i) db_i \approx (1/M) \sum_{m = 1}^M
S_i(t | b_{im}),
where p(b_i)
denotes the normal probability density function, and b_{im}
the m
th
simulated value for the random effect of the i
th sample unit. The cumulative hazard and log cumulative hazard
functions are calculated as H_i(t) = - \log S_i(t)
and \log H_i(t) = \log \{ - \log S_i(t)\},
respectively.
Value
a numeric vector of fitted values.
Author(s)
Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl
References
Rizopoulos, D. (2012) Joint Models for Longitudinal and Time-to-Event Data: with Applications in R. Boca Raton: Chapman and Hall/CRC.
Rizopoulos, D. (2010) JM: An R Package for the Joint Modelling of Longitudinal and Time-to-Event Data. Journal of Statistical Software 35 (9), 1–33. doi:10.18637/jss.v035.i09
See Also
Examples
## Not run:
# linear mixed model fit
fitLME <- lme(log(serBilir) ~ drug * year,
random = ~ 1 | id, data = pbc2)
# survival regression fit
fitSURV <- survreg(Surv(years, status2) ~ drug,
data = pbc2.id, x = TRUE)
# joint model fit, under the (default) Weibull model
fitJOINT <- jointModel(fitLME, fitSURV, timeVar = "year")
# fitted for the longitudinal process
head(cbind(
"Marg" = fitted(fitJOINT),
"Subj" = fitted(fitJOINT, type = "Subject")
))
# fitted for the event process - survival function
head(cbind(
"Marg" = fitted(fitJOINT, process = "Ev"),
"Subj" = fitted(fitJOINT, process = "Ev", type = "Subject")
))
# fitted for the event process - cumulative hazard function
head(cbind(
"Marg" = fitted(fitJOINT, process = "Ev",
scale = "cumulative-Hazard"),
"Subj" = fitted(fitJOINT, process = "Ev", type = "Subject",
scale = "cumulative-Hazard")
))
## End(Not run)