##Orthodont data from Pinheiro and Bates (2000) revisited
require(nlme)
m1 <- gls(distance ~ age, correlation = corCompSymm(value = 0.5, form = ~ 1 | Subject),
data = Orthodont, method= "ML")
##compare against lme fit
identical(logLik(m1),
logLik(lme(distance ~ age, random = ~1 | Subject, data = Orthodont,
method= "ML")))
##both are identical
##compute predictions and SE's for different ages
predictSE.gls(m1, newdata = data.frame(age = c(8, 10, 12, 14)))
Run the code above in your browser using DataLab