Fellow R-users, I have a longitudinal data set with missing values in it. I would like to produce a residual plot for each time using panel.xyplot function but I get an error message. Here's a simple example,
library(nlme) set.seed(1544) longdata <- data.frame(ID=gl(10,1,50), y=rnorm(50), time = as.numeric(gl(5,10,50)), x = rnorm(50)) longdata$y[5] <- NA longdata$x[35] <- NA modlme<- lme(fixed=y ~ time + x, random= ~ 1 | ID, na.action=na.exclude, data=longdata) plot( modlme, abs( resid(., type = 'p')) ~ fitted(.) | time, panel = function(x, y, ...) { panel.xyplot( x, y, ...) panel.loess( x, y,...) }) where the last call produces the error message Error in `[[<-.data.frame`(`*tmp*`, j, value = c(1, 1, 1, 1, 1, 1, 1, : replacement has 48 rows, data has 50 How do I fix this? Any help would be greatly appreciated. Greg ps my sessioninfo is > sessionInfo() R version 2.9.1 (2009-06-26) i386-pc-mingw32 locale: LC_COLLATE=English_Canada.1252;LC_CTYPE=English_Canada.1252;LC_MONETARY=English_Canada.1252;LC_NUMERIC=C;LC_TIME=English_Canada.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] nlme_3.1-96 loaded via a namespace (and not attached): [1] grid_2.9.1 lattice_0.17-25 > [[alternative HTML version deleted]]
______________________________________________ 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.