[R-sig-ME] LMER: Visualizing three-way interaction

Ramon Diaz-Uriarte rdiaz02 at gmail.com
Fri Apr 14 09:28:49 CEST 2017

Dear Klemens,

You might want to take a look at the effects package, by John Fox and
collaborators. It allows to visualize different types of interactions,
including conditional plots, with a lot of control over what and how, deals
with fits from lmer, and can also plot partial residuals, which I find
extremely useful for diagnostic purposes.



On Wed, 12-04-2017, at 11:41:00, Klemens Knöferle <knoeferle at gmail.com> wrote:
> Hi all,
> I'm trying to visualize a three-way interaction from a rather complex
> linear mixed model in R (lmer function from the lme4 package; the model has
> a complex random-effects structure). The interaction consists of two
> continuous variables and one categorical variable (two experimental
> conditions).
> So far, I have graphed the interaction via two 3D-surface plots using
> visreg2d from the visreg package. But my reviewers found these plots
> confusing and asked for a different illustration, such as conditional
> coefficient plots (i.e., plots of the strength of coefficient 1 as
> coefficient 2 increases).
> I've tried to find a package that allows me to create these kind of plots,
> but failed. The existing packages only allow coefficient plots for two-way
> interactions (for instance the interplot package;
> https://cran.r-project.org/web/packages/interplot/vignettes/interplot-vignette.html).
> That means I only get a conditional coefficient plot of the two-way
> interaction, collapsed across both levels of the categorical variable.
> Is there a package for my case? If not, I probably have to manually extract
> fitted values from my model (e.g., using broom) and somehow plot them in
> ggplot2. But I don't really know how to do this, whether or not to take
> into account random effects (and how), etc. Any ideas would be much
> appreciated...
> Klemens Knöferle, Ph.D.
> Associate Professor - Department of Marketing
> BI Norwegian Business School
> Visiting address: Nydalsveien 37, 0484 Oslo
> 	[[alternative HTML version deleted]]
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-25
Facultad de Medicina
Universidad Autónoma de Madrid 
Arzobispo Morcillo, 4
28029 Madrid

Phone: +34-91-497-2412

Email: rdiaz02 at gmail.com
       ramon.diaz at iib.uam.es


More information about the R-sig-mixed-models mailing list