# Random effect form (interaction of fixed effects in random effect?)

I have a problem with my random effect definition. Lets say I have a mixed effect model predicting species richness (S) by precipitation (P) and temperature (T) in different places - different datasets together (dataset) (that is the random effect). I am also interested in interaction between temperature and precipitation.

Now I have a mixed effect model (actually it is more complicated but doesnt matter for this qustion) with variying both slope and intercept by datasets and I am not sure if the fixed effects (temperature and precipitation) should be in random effect also with interaction or just as a sum, i.e. (using lmer function in R)

S ~ T*P + (1+(T + P)|dataset)

or

S ~ T*P + (1+(T * P)|dataset)

Is it both possible with different interpretation or just one is correct?

Thank you!

• Both are possible, but they are obviously different models. Whether you should include the interaction in the random effect depends on your specific problem and your specific data (is there sufficient data to justify and estimate an additional parameter?). You could compare the AIC of the models. – Roland Mar 20 '18 at 7:48
• Thanks. My data are quite big (ca 20 thousand points in 50 "datasets"). Indeed, I understand the difference - the coefficient for interaction differs between datasets for the second model (with interaction in random effect). AIC of this more complex model is also lower and I think the second one is also more correct considering the interpretation. The problem is that in 1. model (without the interaction in random effect) the fixed effect of interaction is highly significant, while in 2. model (with the interaction in random effect) the fixed effect of interaction becomes non significant.Cont.. – ElB Mar 20 '18 at 11:43
• That is why I am thinking about the meaning of fixed effect of interaction (without being in random effect - 1. model) and if it makes any sense. – ElB Mar 20 '18 at 11:45
• That a model parameter is not significantly different from zero is by itself not a reason for changing the model. However, first rule of statistics: Plot your data and the model predictions. – Roland Mar 20 '18 at 14:35
• Thanks. I think the key question for me now is: What does it say about the data that the interaction between effect of temperature and precipitation changes from highly significant to insignificant when it is added also to random effect? I feel is it something really elementary but I still canot figure it out. – ElB Mar 21 '18 at 6:46