[R] Interaction plot between 2 continuous variables

Bert Gunter gunter.berton at gene.com
Sun May 6 22:39:48 CEST 2012


This almost certainly has nothing to do with mixed effects models per
se. x1 and x2 are probably ( if what you see is not due to a few
unusual values) correlated, so the standard decomposition into main
and interaction effects does not have the usual meaningful
interpretation (e,g, that you would get from orthogonal regressors).

Please learn to use (R's) Help/search system.

??interaction (which is shorthand for help.search("interaction") would
have gotten you to
?interaction.plot

which is in base R.  Even googling on (what else?) "R interaction
plot" would have gotten you there as the first hit!

I think this is basically what you want.

-- Bert


On Sun, May 6, 2012 at 12:38 PM, Eiko Fried <torvon at gmail.com> wrote:
> I have two very strong fixed effects in a LMM (both continuous variables).
> model <- lmer( y ~ time + x1+x2 + (time|subject))
>
> Once I fit an interaction of these variables, both main effects
> disappear and I get a strong interaction effect.
> model <- lmer( y ~ time + x1*x2 + (time|subject))
>
> I would like to plot this effect now, but have not been able to do so,
> reading through ggplot2 and lattice tutorials.
>
> Any help would be greatly appreciated. Thank you!
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list