2

I'm trying to fit a glmm model on my data and I am not sure how to include an interaction between some of my fixed effects. Im using the glmer function from lme4.

glmer(x ~ a + b + a*b + (1|random))
glmer(x ~ a + b + a:b + (1|random))
glmer(x ~ a*b + (1|random))

is writing the a and the b separately redundant??

aosmith
  • 34,856
  • 9
  • 84
  • 118
  • `a*b` expands to `a + b + a:b`, although R doesn't have trouble with the redundant terms if you mistakenly write things as you did in your first model. See the help page for `formula` (and [this related question/answer](https://stackoverflow.com/questions/40567421/vs-in-r-for-modelling)) for more details. – aosmith May 30 '18 at 14:35

0 Answers0