help
help > design matrix of ANOVA
Nov 17, 2017 12:11 AM | Andrew Zalesky
design matrix of ANOVA
Hi Xiaonan,
the first formulation (factor effects) is the formulation that is expected by NBSglm.This will work correctly. You can also use a t-test instead of F-test to assess one-sided alternative hypotheses.
I don't think the cell formulation will work correctly.
The column of 1's simply models the global mean. It is not particularly surprising that this column is significant, especially if you do not de-mean your data. This is not a problem. Not sure what you mean by finding a NaN.
Andrew
Originally posted by Xiaonan Guo:
the first formulation (factor effects) is the formulation that is expected by NBSglm.This will work correctly. You can also use a t-test instead of F-test to assess one-sided alternative hypotheses.
I don't think the cell formulation will work correctly.
The column of 1's simply models the global mean. It is not particularly surprising that this column is significant, especially if you do not de-mean your data. This is not a problem. Not sure what you mean by finding a NaN.
Andrew
Originally posted by Xiaonan Guo:
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
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
Title | Author | Date |
---|---|---|
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 | |