0
votes

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.

1
is there some chance you could give us a reproducible example ?Ben Bolker
just a guess, but how about plot(Model,resid(.)~fitted(.)|factor(F2))?Ben Bolker

1 Answers

0
votes

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