help > design matrix of ANOVA
Nov 16, 2017  06:11 PM | Xiaonan Guo
design matrix of ANOVA
Hi Andrew,
When I perform between-subject two-way ANOVA using NBSglm, I am somewhat confused about the design matrix. I tried two types of design matrix with corresponding contrast matrix, but got different observed test statistics. Here is a short example,
The first one is factor effects approach:
1  1  1  1
1  1  1  1
1  -1  -1  1
1  -1  -1  1
-1  1  -1  1
-1  1  -1  1
-1  -1  1  1
-1  -1  1  1
Where the first column is the group, the second column gender, 3rd the interaction effect between group and gender, 4th column is intercept.
My F contrasts are [1 0 0 0],[0 1 0 0],[0 0 1 0] for main effects of group and gender and interaction effect, respectively.
The second one is cell approach:
1 0 0 0
1 0 0 0
0 1 0 0
0 1 0 0
0 0 1 0
0 0 1 0
0 0 0 1
0 0 0 1
My F contrasts are [1 1 -1 -1], [1 -1 1 -1], [1 -1 -1 1].
Which one is correct for NBSglm?
Another question, in the case of cell approach, all the main effects and interaction effect are the same. It seems that there's somethings wrong with this approach.


Then if I used the factor effects approach, there's another question that confused me. If all the responsible variables are the same for all subjects, for example a column of ones, we will find significant main effect. That's really strange. I also tried glmfit to perform the same procedure, and all the results are NaN. Why does this happen?



Best wishes,
Xiaonan

Threaded View

TitleAuthorDate
design matrix of ANOVA
Xiaonan Guo Nov 16, 2017
Andrew Zalesky Nov 17, 2017
Xiaonan Guo Nov 17, 2017
Andrew Zalesky Nov 17, 2017
Xiaonan Guo Nov 17, 2017