help > 2-way ANOVA matrix design and contrast
Showing 1-7 of 7 posts
May 22, 2017 04:05 AM | Jeff Jiang
2-way ANOVA matrix design and contrast
Hi Andrew,
I have a data with 2 factors, each with 2 levels: a1, a2, b1, b2. Now I want to test for both the main effects and a*b interaction effect. The design matrix is written as follows (a1b1 a1b2 a2b1 a2b2, assume there are 2,3,3,2 subjects in each group, respectively):
1 0 0 0
1 0 0 0
0 1 0 0
0 1 0 0
0 1 0 0
0 0 1 0
0 0 1 0
0 0 1 0
0 0 0 1
0 0 0 1
The contrast is written as [1,1,-1,-1] for main effect of a, [1,-1,1,-1] for main effect of b, and [1,-1,-1,1] for the interaction effect.
However, when I used the F-test to perform the above three tests respectively, the final NBS results are the same. Can you please help check whether the design matrix and contrasts are set correctly for NBS? Thanks a lot!
Regards,
Jeff
I have a data with 2 factors, each with 2 levels: a1, a2, b1, b2. Now I want to test for both the main effects and a*b interaction effect. The design matrix is written as follows (a1b1 a1b2 a2b1 a2b2, assume there are 2,3,3,2 subjects in each group, respectively):
1 0 0 0
1 0 0 0
0 1 0 0
0 1 0 0
0 1 0 0
0 0 1 0
0 0 1 0
0 0 1 0
0 0 0 1
0 0 0 1
The contrast is written as [1,1,-1,-1] for main effect of a, [1,-1,1,-1] for main effect of b, and [1,-1,-1,1] for the interaction effect.
However, when I used the F-test to perform the above three tests respectively, the final NBS results are the same. Can you please help check whether the design matrix and contrasts are set correctly for NBS? Thanks a lot!
Regards,
Jeff
May 23, 2017 07:05 AM | Jeff Jiang
RE: 2-way ANOVA matrix design and contrast
Hi Andrew,
Regarding to my last question, I also tried another design matrix and contrast:
intercept a b interaction
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
1 1 1 1
1 1 1 1
And contrast is [0 1 0 0] for main effect a, [0 0 1 0] for main effect b, and [0 0 0 1] for a*b interaction effect.
According to my understanding, this design and contrast should be equivalent to the ones in my last post (I also found that the FSL manual said these two are equivalent). However, I got totally different F-test results using NBS based on the two settings. Could you please help? Thanks.
Regards,
Jeff
Regarding to my last question, I also tried another design matrix and contrast:
intercept a b interaction
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
1 1 1 1
1 1 1 1
And contrast is [0 1 0 0] for main effect a, [0 0 1 0] for main effect b, and [0 0 0 1] for a*b interaction effect.
According to my understanding, this design and contrast should be equivalent to the ones in my last post (I also found that the FSL manual said these two are equivalent). However, I got totally different F-test results using NBS based on the two settings. Could you please help? Thanks.
Regards,
Jeff
May 23, 2017 08:05 AM | Andrew Zalesky
RE: 2-way ANOVA matrix design and contrast
Hi Jeff,
The design matrix and contrast you have given below are correct. The ones in your previous post are not correct. The two design matrices are not really equivalent in that way you are defining main effects and interaction.
Andrew
Originally posted by Jeff Jiang:
The design matrix and contrast you have given below are correct. The ones in your previous post are not correct. The two design matrices are not really equivalent in that way you are defining main effects and interaction.
Andrew
Originally posted by Jeff Jiang:
Hi Andrew,
Regarding to my last question, I also tried another design matrix and contrast:
intercept a b interaction
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
1 1 1 1
1 1 1 1
And contrast is [0 1 0 0] for main effect a, [0 0 1 0] for main effect b, and [0 0 0 1] for a*b interaction effect.
According to my understanding, this design and contrast should be equivalent to the ones in my last post (I also found that the FSL manual said these two are equivalent). However, I got totally different F-test results using NBS based on the two settings. Could you please help? Thanks.
Regards,
Jeff
Regarding to my last question, I also tried another design matrix and contrast:
intercept a b interaction
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
1 1 1 1
1 1 1 1
And contrast is [0 1 0 0] for main effect a, [0 0 1 0] for main effect b, and [0 0 0 1] for a*b interaction effect.
According to my understanding, this design and contrast should be equivalent to the ones in my last post (I also found that the FSL manual said these two are equivalent). However, I got totally different F-test results using NBS based on the two settings. Could you please help? Thanks.
Regards,
Jeff
May 23, 2017 09:05 AM | Jeff Jiang
RE: 2-way ANOVA matrix design and contrast
Hi Andrew,
Thanks a lot for your reply. I'm still confused why the design matrix and contrast in my first post is not correct. Please check the attached screenshot from FSL website. I defined the main effects and interaction exactly the same as the FSL. If I use the design matrix in my first post, could you please guide me how to define the contrast for the main effects and interaction correctly in NBS?
Thanks a lot!
Jeff
Originally posted by Andrew Zalesky:
Thanks a lot for your reply. I'm still confused why the design matrix and contrast in my first post is not correct. Please check the attached screenshot from FSL website. I defined the main effects and interaction exactly the same as the FSL. If I use the design matrix in my first post, could you please guide me how to define the contrast for the main effects and interaction correctly in NBS?
Thanks a lot!
Jeff
Originally posted by Andrew Zalesky:
Hi Jeff,
The design matrix and contrast you have given below are correct. The ones in your previous post are not correct. The two design matrices are not really equivalent in that way you are defining main effects and interaction.
Andrew
Originally posted by Jeff Jiang:
The design matrix and contrast you have given below are correct. The ones in your previous post are not correct. The two design matrices are not really equivalent in that way you are defining main effects and interaction.
Andrew
Originally posted by Jeff Jiang:
Hi Andrew,
Regarding to my last question, I also tried another design matrix and contrast:
intercept a b interaction
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
1 1 1 1
1 1 1 1
And contrast is [0 1 0 0] for main effect a, [0 0 1 0] for main effect b, and [0 0 0 1] for a*b interaction effect.
According to my understanding, this design and contrast should be equivalent to the ones in my last post (I also found that the FSL manual said these two are equivalent). However, I got totally different F-test results using NBS based on the two settings. Could you please help? Thanks.
Regards,
Jeff
Regarding to my last question, I also tried another design matrix and contrast:
intercept a b interaction
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
1 1 1 1
1 1 1 1
And contrast is [0 1 0 0] for main effect a, [0 0 1 0] for main effect b, and [0 0 0 1] for a*b interaction effect.
According to my understanding, this design and contrast should be equivalent to the ones in my last post (I also found that the FSL manual said these two are equivalent). However, I got totally different F-test results using NBS based on the two settings. Could you please help? Thanks.
Regards,
Jeff
May 23, 2017 11:05 PM | Andrew Zalesky
RE: 2-way ANOVA matrix design and contrast
Hi Jeff,
please see the example that is provided directly below the screenshot that you provided. This is the correct design matrix and contrast to use for the NBS - i.e. the design you specified in your second post. The design in your first post won't work correctly.
Andrew
please see the example that is provided directly below the screenshot that you provided. This is the correct design matrix and contrast to use for the NBS - i.e. the design you specified in your second post. The design in your first post won't work correctly.
Andrew
May 24, 2017 01:05 AM | Jeff Jiang
RE: 2-way ANOVA matrix design and contrast
Hi Andrew,
Thanks! There are two approaches "cell means approach" and 'factor effects approach' which are provided directly above and below the screenshot I provided, corresponding to the design matrix & contrast in my first and second post, respectively. In the screenshot, it is said that these two approaches are equivalent. If I understand correctly, you mean that NBS only supports the approach below the screenshot (i.e., in my second post), while the "cell means approach" directly above the screenshot (i.e., in my first post) is not supported in NBS?
Thanks and sorry for my continuing question.
Regards,
Jeff
Originally posted by Andrew Zalesky:
Thanks! There are two approaches "cell means approach" and 'factor effects approach' which are provided directly above and below the screenshot I provided, corresponding to the design matrix & contrast in my first and second post, respectively. In the screenshot, it is said that these two approaches are equivalent. If I understand correctly, you mean that NBS only supports the approach below the screenshot (i.e., in my second post), while the "cell means approach" directly above the screenshot (i.e., in my first post) is not supported in NBS?
Thanks and sorry for my continuing question.
Regards,
Jeff
Originally posted by Andrew Zalesky:
Hi Jeff,
please see the example that is provided directly below the screenshot that you provided. This is the correct design matrix and contrast to use for the NBS - i.e. the design you specified in your second post. The design in your first post won't work correctly.
Andrew
please see the example that is provided directly below the screenshot that you provided. This is the correct design matrix and contrast to use for the NBS - i.e. the design you specified in your second post. The design in your first post won't work correctly.
Andrew
May 24, 2017 12:05 PM | Andrew Zalesky
RE: 2-way ANOVA matrix design and contrast
Hi Jeff, I haven't had a close look at
these alternative models, but I can assure you that the design
matrix and contrast described in your second email is correct. I
hope you find the tool useful!
Andrew
Originally posted by Jeff Jiang:
Andrew
Originally posted by Jeff Jiang:
Hi
Andrew,
Thanks! There are two approaches "cell means approach" and 'factor effects approach' which are provided directly above and below the screenshot I provided, corresponding to the design matrix & contrast in my first and second post, respectively. In the screenshot, it is said that these two approaches are equivalent. If I understand correctly, you mean that NBS only supports the approach below the screenshot (i.e., in my second post), while the "cell means approach" directly above the screenshot (i.e., in my first post) is not supported in NBS?
Thanks and sorry for my continuing question.
Regards,
Jeff
Originally posted by Andrew Zalesky:
Thanks! There are two approaches "cell means approach" and 'factor effects approach' which are provided directly above and below the screenshot I provided, corresponding to the design matrix & contrast in my first and second post, respectively. In the screenshot, it is said that these two approaches are equivalent. If I understand correctly, you mean that NBS only supports the approach below the screenshot (i.e., in my second post), while the "cell means approach" directly above the screenshot (i.e., in my first post) is not supported in NBS?
Thanks and sorry for my continuing question.
Regards,
Jeff
Originally posted by Andrew Zalesky:
Hi Jeff,
please see the example that is provided directly below the screenshot that you provided. This is the correct design matrix and contrast to use for the NBS - i.e. the design you specified in your second post. The design in your first post won't work correctly.
Andrew
please see the example that is provided directly below the screenshot that you provided. This is the correct design matrix and contrast to use for the NBS - i.e. the design you specified in your second post. The design in your first post won't work correctly.
Andrew