tmpar <- par(mfrow=c(1,2),mar=c(3.1,3.1,0,0)) mplot(leprosy$x,resid(leprosy.drug),group=leprosy$drug, ylim=c(-12,12),xlab="",ylab="") mtext("(a) before",1,2) abline(0,0,lty=2) tmp <- data.frame(y=resid(leprosy.drug),x=leprosy$x) lines(sort(tmp$x), predict(lm(y~x,tmp))[order(tmp$x)],lty=1) se.bar(17,-5,std.dev(leprosy.drug),cap="SD") mplot(predict(leprosy.x),resid(leprosy.x),group=leprosy$drug, ylim=c(-12,12),xlab="",ylab="") mtext("(b) predicted",1,2) mtext("residual",2,2) abline(0,0,lty=2) tmp <- data.frame(y=resid(leprosy.x),drug=leprosy$drug) mlines(predict(leprosy.x),predict(aov(y~drug,tmp)),group=tmp$drug) legend(0,-6,c("A","B","C"),lty=1:3) se.bar(14,-9,std.dev(leprosy.x),cap="SD") par(tmpar)