I would like to specify some interaction terms before all main effects in a linear model, but am finding it difficult to do in R, so I am wondering if there is a statistical reason why I shouldn't? The reason for specifying the order in the model is that next I want to use a type I ANOVA to investigate the effects of different variables.
I want this model:
y ~ x1 + x2 + x1:x2 + x3 + x1:x3 + x2:x3 + x1:x2:x3
But R insists on this model (no matter what order I type the terms in)*:
y ~ x1 + x2 + x3 + x1:x2 + x1:x3 + x2:x3 + x1:x2:x3
The purpose of using the first model and a type I ANOVA would be to account for all variance explained by
x2 before seeing if any remaining variance is explained by
x3. Is there any reason why I shouldn't be trying to do this?
- Actually it is not that hard to do in R.
- Maybe it helps to specify that in my case, x1 and x2 are factors and x3 is continuous.