# Plots to illustrate results of linear mixed effect model

I've been analysing some data using linear mixed effect modelling in R. I'm planning to make a poster with the results and I was just wondering if anyone experienced with mixed effect models could suggest which plots to use in illustrating the results of the model. I was thinking about residual plots, plot of fitted values vs original values, etc.

I know this will very much depend on my data but I was just trying to get a feel for the best way to illustrate results of linear mixed effect models. I'm using the nlme package in R.

Thanks

It depends on your model, but, in my experience, even colleagues, who don't have a good understanding of mixed effects models, really like if you plot the predictions with different grouping levels:

library(nlme)
fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1|Subject)

newdat <- expand.grid(Sex=unique(Orthodont$Sex), age=c(min(Orthodont$age),
max(Orthodont\$age)))

library(ggplot2)
p <- ggplot(Orthodont, aes(x=age, y=distance, colour=Sex)) +
geom_point(size=3) +
geom_line(aes(y=predict(fm2), group=Subject, size="Subjects")) +
geom_line(data=newdat, aes(y=predict(fm2, level=0, newdata=newdat), size="Population")) +
scale_size_manual(name="Predictions", values=c("Subjects"=0.5, "Population"=3)) +
theme_bw(base_size=22)
print(p)


• @ Roland, thanks for your answer. My model is a linear mixed effect model containing independent and dependent variables with some covariates. May 17, 2014 at 9:35
• @ Roland, can I just ask if fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1|Subject) is the same as fm3 <- lme(distance ~ age*Sex, data = Orthodont, random = ~ 1|Subject) . I'm trying to use Sex as a covariate for the model. May 17, 2014 at 12:43
• No. age * Sex is the same as age + Sex + age:Sex, i.e., it includes the interaction. May 17, 2014 at 12:49
• Yes, of course. You'd need to remove colour=Sex. May 17, 2014 at 17:23
• Yes, but that's basic ggplot2 functionalty. Study the documentation and tutorials. You might want to use scale_colour_manual. May 20, 2014 at 11:33