# Is it ok to define the contrasts after building the model?

I have this mode starting model but I need to build the random structure but I am not sure if I can do that without setting the contrasts. Variable Time is a 3-level factor and I want to run pairwise comparisons but that is not an option for the standard contrasts, so I will run emmeans (after building the model). Will that influence the results? I usually set the contrasts before building the model.

model <- lmer(RT ~ Block * Type * Time + (1 | Participant), data = Data.trimmed,
REML = FALSE)

• The idea of defining the contrasts you need ahead of time real only works when you have only one factor, and then only sometimes. In multi-factor situations, it’s really not doable except perhaps when they are all two- level factors. – Russ Lenth Jan 11 at 3:12
• Thank you for your help, I usually set them up before running building the models when I am interested in the contrasts that are available in R. This time I did not have that option so I was wondering if it would make a difference for model selection. – CatM Jan 13 at 16:13
• It's OK to do that, but it doesn't buy you much; you do not get direct estimates of all the treatment means and their SEs; unless of course you omit the intercept and then get only those and no contrasts. A package like emmeans can estimate all of the means and any set of contrasts among them, and gives the same answers for any contrast coding. Plus flexibility in handling multi-factor situations. – Russ Lenth Jan 13 at 16:36
• For model selection, I guess if you are talking about choosing only some of the dummy variables for a given factor, how those are defined definitely makes a difference. Normally, though, I think in model-selection with factors, people either include all levels, or exclude all levels, and then it makes no difference how they are coded because any coding will span the same linear space. – Russ Lenth Jan 13 at 16:38