# NOT RUN {
# linear mixed model fit
fitLME <- lme(log(serBilir) ~ drug * ns(year, 2), data = subset(pbc2, id != 2),
random = ~ ns(year, 2) | id)
DF <- IndvPred_lme(fitLME, newdata = subset(pbc2, id == 2), timeVar = "year",
M = 500, return_data = TRUE)
require(lattice)
xyplot(pred + low + upp ~ year | id, data = DF,
type = "l", col = c(2,1,1), lty = c(1,2,2), lwd = 2,
ylab = "Average log serum Bilirubin")
# extract_lmeComponents() extract the required components from the lme object
# that are required to calculate the predictions; this is a light weight version of
# the object, e.g.,
fitLME_light <- extract_lmeComponents(fitLME, timeVar = "year")
DF <- IndvPred_lme(fitLME_light, newdata = subset(pbc2, id == 2), timeVar = "year",
M = 500, return_data = TRUE)
# }
Run the code above in your browser using DataLab