Mixed models : How to do contrast-coding with a variable that has 3 levels?

I have recently discovered contrast-coding which compared to dummy-coding just seemed to be a more efficient approach for working with mixed models. Here is the (simplified) logic I followed which will make the question more apparent :


Specifying contrasts...

> contrasts(TASK1_Reaction_Times$TYPE_OF_LEARNING)<-c(-0.5,0.5)
> contrasts(TASK1_Reaction_Times$MOMENT_OF_TEST)<-c(-0.5,0.5)

...centering both variables around 0

> contrasts(TASK1_Reaction_Times$TYPE_OF_LEARNING)
      [,1]
ORTHOGRAPHIC_LEARNING -0.5
PHONOLOGICAL_LEARNING  0.5

> contrasts(TASK1_Reaction_Times$MOMENT_OF_TEST)
          [,1]
IMMEDIATELY -0.5
AFTER_ONE_WEEK 0.5

Building the maximally converging model

> TASK1 <- lmer(RT ~ TYPE_OF_LEARNING * MOMENT_OF_TEST
  + (1 + MOMENT_OF_TEST) + (1 + TYPE_OF_LEARNING), 
   data = TASK1_Reaction_Times)

Checking the summary output

> summary(TASK1)

(...)

Fixed effects:
                         Estimate Std. Error         df     t value      Pr(>|t|)    
(Intercept)                  1000         25         50          40    0.0005 ***
TYPE_OF_LEARNING1             100         25        100          10    0.0005 ***
MOMENT_OF_TEST1              -100         25         50         -10    0.0005 ***
(values are grossly simplified)

It is my understanding that this suggests that the reaction times for participants that had learned the words orthographically are about 100ms faster than participants that had learned the words phonologically; and that reaction times were on average 100ms slower one week after the initial test.


Here is my question : What do I do if my variable has three levels instead of just two ?
(e.g. three types of learning, three moments of testing)

Is it still possible to use this approach then ?
How do I contrast-code my variables in such a case (-0.5,0,0.5 ?) ?

Hi @asderad ,

I wonder whether — given the statistical content of your question — it might make sense to post your question on Cross Validated, Stack Echange's statistics site.