Reputation: 11
I did a mixed model with lme, with two random factor F1 (6 levels) and F2 (4 levels).
MiModel<-lme(iv~d1+d1_id,list(Fact1=~1+d1,
Fact2=~-1+d1),
data=MiData,method="REML")
I would like to plot the residual versus predicted values, in some different figures, one for each one of the F2 levels.
I tried this:
plot(Model,resid(.)~fitted(.)|factor(F1)+factor(F2))
However I get a large figure with 6 x 4 plots.
Is it possible to do something simmilar but splitting the figure in 4 diferent plots, one for each F2 level?
Thanks in advance.
Upvotes: 0
Views: 462
Reputation: 11
Thank you for your answer, but the option you proposed is not what I need, because the I get four plots, one for each factor F2, but with all F1 together.
Finally I decided to solve it with a bucle. I don't know if it is the best but it works...
for (in in levels(factor(F2)){
NewData<-subset(MiData,F2==i)
NewData$fitt<-predict(MiModel,newdata=NewData)
xyplot(x~fitt|factor(F1), data=NewData)
}
Now I fighting with the scales free, but similar in x and y.
Thanks again
Upvotes: 1