LMM in JASP: factor coding
Hello!
I have ventured lmm with JASP: it is absolutely amazing!
But I have a question about factor coding. As far as I know, it is a dummy coding. How does it specify the contrasts of a factor with 3 levels (say, color: red, blue and green)? I run a full model of a such a factor + several continious (say, age) and categorical variables (luckily with only 2 levels:), say, gender), and the outcome shows me the following:
Color (1) Estimate SE...etc
Color (2) Estimate SE etc....
Color (1) * Age Estimate SE etc...
Color (2) * Age Estimate SE etc...
Color (1) * Gender Estimate SE etc...
How do I interpret Color (1) and Color (2) and the respective interactions? What is compared to what?
Many thanks for your help!
Comments
Hi Katharina,
happy to hear about your positive experience!
The analysis uses sum contrast coding for categorical (nominal / factors, ordinal) predictors (in contrast to R which uses dummy encoding by default). This scheme is used for better interpretability of models with interactions. However, the fixed and random effects estimates will differ from those obtained from R with default settings. We advise using the 'Estimated marginal means' section for obtaining mean estimates at individual factor levels. For comparing the mean estimates, you can use the contrasts option.
For example, if you are interested in the mean estimates of different colors, you can add the Color variable into 'Selected variables' box in 'Estimated marginal means'. Similarly, you can add the Gender variable as well and obtain mean estimates for each combination of Gender and Color. If you want to compare those estimates, you can click on 'Specify contrasts' and set the comparisions you are interested in. Setting .5 for one of the colors and -.5 for another one will create a test for the difference between estimated means of each color.
Cheers,
Frantisek
Thank you for your quick answer. This is all clear. I still do not understand what
Color (1) Estimate SE...etc
Color (2) Estimate SE etc...
would mean
Is Color (1) and Color (2) - a contrast between all and red and blue or something else? Beacuse usually you would then have Color1, Color 2 and Color 3, if you compare to grand mean?
How should I interpret that: Color (1) had a significant effect on Y. But what is Color (1)?
If you have a factor with more than two levels (such as your color) our recommendation is that you do not interpret the estimates of the model directly (so to answer your question: you don't). This holds for both the classical (which I assume you have used) and Bayesian LMMs.
Instead, you (a) inspect the omnibus test. If they show a (say) significant interaction of color and age you do (b) what Frantisek suggests and use either the 'Estimated marginal means' functionality or the 'Estimated trends' option. The former allows you to test for the effect of color for different values of age whereas the later allows you to look at the different slopes of age for the different colors.
Ok, thank you!
It does get complicated when one has many factors :)
But so I thought...