# Can I include an interaction between factors as random effect in mixed model?

I am analysing a variable (DV) as a function of an experimental manipulation (X), presented in different visual contexts.The DV varies by subject and context. I have repeated measures per subject and context at the different levels of X.

To capture by-subject variation in the DV, I add a random intercept/slope for each partcipant (using lme4 in R):

$DV$ ~ $X + (X|Subject)$

The context really describes an interaction between three stimulus factors (say: color (2) $*$ direction (2) $*$ form (2)).

Separately, these factors cannot be treated as random effects, having only two levels each. Instead, including their interaction (8 levels) - I am afraid I am ignoring something (like the factor-levels being related or not "random").

Thus, my question: Is it valid to use the interaction between (these) factors as a random effect (such as: $DV$ ~ $X + (X|Sub)+(X|C)$ )?

Thanks!

• Is C the eight level factor formed from the interaction? – mdewey Oct 20 '17 at 13:05
• yes, exactly! C is the factor from the interaction. – Marie Oct 20 '17 at 15:07
• Your model formula looks fine to me. Think of it this way - there is no difference between three two-level main effects with all their interactions and a single eight level factor. – mdewey Oct 20 '17 at 15:09
• thanks!!! I wasnt sure if there is something wrong with it because the variances at the different levels may be related or something (compared to when you have subjects as random effect levels) – Marie Oct 20 '17 at 16:48