if (FALSE) {
# linear mixed model fit without treatment effect
fitLME.null <- lme(sqrt(CD4) ~ obstime,
random = ~ 1 | patient, data = aids)
# cox model fit without treatment effect
fitCOX.null <- coxph(Surv(Time, death) ~ 1,
data = aids.id, x = TRUE)
# joint model fit without treatment effect
fitJOINT.null <- jointModel(fitLME.null, fitCOX.null,
timeVar = "obstime", method = "weibull-PH-aGH")
# linear mixed model fit with treatment effect
fitLME.alt <- lme(sqrt(CD4) ~ obstime * drug - drug,
random = ~ 1 | patient, data = aids)
# cox model fit with treatment effect
fitCOX.alt <- coxph(Surv(Time, death) ~ drug,
data = aids.id, x = TRUE)
# joint model fit with treatment effect
fitJOINT.alt <- jointModel(fitLME.alt, fitCOX.alt, timeVar = "obstime",
method = "weibull-PH-aGH")
# likelihood ratio test for treatment effect
anova(fitJOINT.null, fitJOINT.alt)
}
Run the code above in your browser using DataLab