if (FALSE) {
# 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")
))
}
Run the code above in your browser using DataLab