How do you plot multiple LME residual plots in one device?

830    Asked by DylanPowell in Data Science , Asked on Jun 1, 2020
Answered by Dylan Powell

stuff from the grid() package can be used to set up viewports, etc., but the simplest method is with the grid.arrange() function from the gridExtra package

library('nlme')

set.seed(101)

treatment <- factor(c(rep("a",4),rep("b",4),rep("c",4)))

response <- rnorm(12,2,1)

explanatory <- rnorm(12,4,1)

test.lme <- lme(response~explanatory,random=~1|treatment)

library('gridExtra')

p1 <- plot(test.lme)

p2 <- plot(form=sqrt(abs(resid(.)))~fitted(.),test.lme)

grid.arrange(p1,p2)


We can also specify no columns and rows for it.



Your Answer

Interviews

Parent Categories