# \donttest{
# Trivariate fit on PBC data -----------------------------------------
data(PBC)
# Subset data and remove NAs
PBC <- subset(PBC, select = c('id', 'survtime', 'status', 'drug', 'time',
'albumin', 'hepatomegaly', 'platelets'))
PBC <- na.omit(PBC)
# Specify trivariate fit
long.formulas <- list(
albumin ~ time*drug + (1 + time|id),
platelets ~ time * drug + (1 + time|id),
hepatomegaly ~ time * drug + (1|id)
)
surv.formula <- Surv(survtime, status) ~ drug
fit <- joint(long.formulas, surv.formula, PBC,
family = list('gaussian', 'poisson', 'binomial'))
R <- residuals(fit, type = 'pearson')
plot(R)
plot(residuals(fit, what = "surv"))
# }
Run the code above in your browser using DataLab