我有示例数据和模型
x<-rep(seq(0,100,by=1),10)
y<-15+2*rnorm(1010,10,4)*x+rnorm(1010,20,100)
id<-NULL
for (i in 1:10){
id<-c(id, rep(i,101))}
dtfr<-data.frame(x=x,y=y, id=id)
library(nlme)
with (dtfr, summary(lme((y)~x,random=~1+x|id, na.action=na.omit )))
model.mx<-with (dtfr, (lme((y)~x,random=~1+x|id, na.action=na.omit )))
pd<-predict(model.mx, newdata=data.frame(x=0:100),level=0)
with (dtfr, plot(x, y))
lines(0:100,predict(model.mx, newdata=data.frame(x=0:100),level=0), col="darkred", lwd=7)
如何提取每个 ID 的建模截距和斜率并绘制每个 ID 的单独轨迹?