- In my study, each participant completed the very same Reaction Time task 3 times in 3 Sessions. I am not entirely sure if I should code the variable "Session" using
contr.treatment
or (a modified version of)contr.sdif
[MASS].
For contr.treatment(3)
(See below), I understand that the first contrast compares the second level against the first level while the second contrast compares the third level against the first level.
2 3
1 0 0
2 1 0
3 0 1
In my study, this is exactly what I wanted: 2vs1 and 3vs1. However, I was told by someone that I should be using contr.sdif instead, assuming because the variable Session is a within-subject (or repeated) variable and that participants will improve across sessions.
However, in the default contr.sdif
matrix, 2vs1 and 3vs2 are compared. I am not interested in 3vs2, so I manually created the following matrix so that 3vs2 is replaced by 3vs1.
#Modified contr.sdif(3) [Not sure if it is correct, if not please let me know]
2-1 3-1
[1,] 0.3333333 -0.3333333
[2,] -0.6666667 -0.3333333
[3,] 0.3333333 0.6666667
#Default contr.sdif(3)
2-1 3-2
[1,] -0.6666667 -0.3333333
[2,] 0.3333333 -0.3333333
[3,] 0.3333333 0.6666667
I am not entirely sure what the differences between the modified contr.sdif and the contr.treatment(3) are. Both are dealing with 2vs1 and 3vs1. I can't seem to find any reference that explains their difference. Is it true that contr.treatment is only for non-successive variable while contr.sdif is for successive categorical variables in which each level may in some way influence each other.
- In the second contrast of the modified contrast.sdif, level 3 is compared against level 1, my understanding of why level 2 is not assigned with 0 is because this level has some influence on the 3vs1 comparison (since this is successive variable we are dealing with (e.g., participants improve across sessions).
In the first contrast of contr.sdif(3), level 2 is compared against level 1. However, level 3 has nothing to do with this 2vs1 comparison (i.e., my performance in session/level 3 will not influence my performance in session/levels 1 and 2 because session 3 takes place AFTER the two sessions. So I don't understand why isn't level 3 assigned with 0 since it has no influence on the 2vs 1 comparison?
- Based on what I have read so far, non-orthogonal contrasts seem to be shunned in ANOVA or regression, so I am wondering if I should avoid using non-orthogonal contrasts like contr.sdif or contr.treatment in lme4.