Thanks Dennis, The code works for perfectly for the data in the example. For some reason, however, I get the following error message when I use a different data set:
> preds <- expand.grid(age = c(30,36,42), Subject = unique(mydata$id)) > predict(lmemodel, preds, na.action=na.omit) Error in predict.lme(lmemodel, preds, na.action = na.omit) : Cannot evaluate groups for desired levels on "newdata" I searched for the error online, and it appears that it results from missing subject IDs (see: http://www.mail-archive.com/r-help@r-project.org/msg100649.html). I checked both the newdata file ('preds') and the predicted values of lmemodel ('predict(lmemodel)'), however, and the subject IDs appear to be in both files. I'm not sure if it's an issue, but the length of the predicted values is shorter (with fewer IDs) than the newdata file (preds) because there is missing data. Any help would be greatly appreciated on this. If it is diagnostic, I attached a .txt file to this message with the contents of preds and predict(lmemodel): http://r.789695.n4.nabble.com/file/n3318524/lmemodel.txt lmemodel.txt -- View this message in context: http://r.789695.n4.nabble.com/Plotting-individual-trajectories-from-individual-growth-model-tp3315494p3318524.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.