I had the opportunity to check out the contrasts in the ANOVA/ANCOVA modules and I found some strange results for the contrasts named deviation, simple and difference.
deviation labels are defined with the wrong reference group.
In case of three groups, for instance, the labels one gets now are:
but the contrasts parameters one actually gets correspond to the following labels:2-1,2,3 (2 against the overal mean)
3-1,2,3 (3 against the overal mean)
I've looked into the module code and for some reason the "deviation" contrasts(1,2,3)-2
(1,2,3)-3
is customly computed. One can use contr.sum() instead to get the right parameters.
Also simple is weird. Contrast simple (as defined by SPSS) is basically dummy coding 0-1, so
each contrast estimate should be the difference between the group scoring 1 in that contrast and the reference group. That's what you get in SPSS and in R using contr.treatment()
However, in the jamovi modules you get the actual difference divided by K, where
K is the number of groups. The inferential test are correct, but the parameter estimate is confusing.
The contrast difference is also defined differently of what the labels say and what you would expect from SPSS and standard R. Assuming again three groups, the first contrast one gets now is the difference between 2 and 1 groups divided by 2. The second is group 3 minus mean(1,2) dived by 3. Again, this behaviour is unexpected by users moving to jamovi from SPSS or SAS.
Because I was using the ANOVA module code for a module I'm developing, I updated the code found in ANOVA and ANCOVA modules such that it now gives contrasts yielding the same results of SPSS and standard R
Code: Select all
if (type == 'simple') {
contrast <- contr.treatment(levels)
dimnames(contrast) <- NULL
} else if (type == 'deviation') {
contrast <- stats::contr.sum(levels)
dimnames(contrast) <- NULL
} else if (type == 'difference') {
contrast <- stats::contr.helmert(levels)
for(i in 1:ncol(contrast))
contrast[,i]<-contrast[,i]/(i*2)
dimnames(contrast) <- NULL
}
marcello