As I haven't found the equivelant of the MASS::stepAIC for mixed models (eg in lmer) what I'm intending to do is to find the best lm model using stepAIC and then go in lmer and add the random effects.
I'm not confident that this approach is the best but my question is how bad this could be.
The code it's like that,
# I'm setting up a big model to consider
lm_big <- lm(res ~ (v1 + v2 + v3 + v4)^2, data= dat)
#stepAIC will choose the "best" model
lm_aic <- MASS::stepAIC(lm_big)
#Then I'm getting the selected model and I add the random effects
lmer1 <- lmer(formula(lm_aic) + (1|r1) + (1|r2), data = dat)
The data is from a DoE studying bread making process. The DoE of 8 points plus 3 repetitions of the central points run twice in two days period(once a day)(here is the r1) and run by two different operators (r2) (randomized). So there are 22 runs in total with 4 factors run in 2-levels and two blocks.