2
$\begingroup$

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)
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Russ Lenth Jan 11 at 3:12
  • $\begingroup$ 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. $\endgroup$ – CatM Jan 13 at 16:13
  • $\begingroup$ 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. $\endgroup$ – Russ Lenth Jan 13 at 16:36
  • $\begingroup$ 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. $\endgroup$ – Russ Lenth Jan 13 at 16:38
5
$\begingroup$

Yes, you can first fit the model using the default treatment contrasts in R, and then you can use the emmeans package to perform the comparisons of interest, also correcting for multiple testing.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.