[R] Plotting individual trajectories from individual growth model

dadrivr dadrivr at gmail.com
Tue Feb 22 05:06:23 CET 2011


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.



More information about the R-help mailing list