help > Design matrix and contrasts for a 3x2 within-subject design
Showing 1-3 of 3 posts
Display:
Results per page:
Oct 13, 2019  02:10 PM | Junjun Li
Design matrix and contrasts for a 3x2 within-subject design
Dear Dr. Zalesky,

Thank you and your team so much for the wonderful tool! 

I've been working with the NBS toolbox with the help of the reference manual and the forum for several days. 
But I'm still not quite sure my design matrix and contrasts are right.

What I have is a 3x2 ANOVA with repeated measure on both factors. For simplicity, let me assume that there are only 2 subjects (Sub1, Sub2), and the factors are denoted by A(a1, a2, a3) and B (b1, b2), respectively. Both A (3 levels) and B (2 levels) are within-subject factors.

The design matrix that I constructed is:

1   0   0   1   0   1   0  (sub1 a1b1)
0   1   0   0   1   1   0  (sub1 a2b1)
0   0   0   0   0   1   0  (sub1 a3b1)
1   0   1  -1   0   1   0  (sub1 a1b2)
0   1   1   0  -1   1   0  (sub1 a2b2)
0   0   1   0   0   1   0  (sub1 a3b2)
1   0   0   1   0   0   1  (sub2 a1b1)
0   1   0   0   1   0   1  (sub2 a2b1)
0   0   0   0   0   0   1  (sub2 a3b1)
1   0   1  -1   0   0   1  (sub2 a1b2)
0   1   1   0  -1   0   1  (sub2 a2b2)
0   0   1   0   0   0   1  (sub2 a3b2)

The 1st and 2nd columns model the main effect of factor A.
The 3rd column is factor B.
The 4th and 5th columns model the AxB interaction.
The 6th and 7th columns model the two subjects.

To test for the the AxB interaction, I selected an F-test and contrast [0 0 0 1 1 0 0].
To test for the main effect of factor A, I selected an F-test and contrast [1 1 0 0 0 0 0].
And to test for the main effect of factor B, I selected an F-test and contrast [0 0 1 0 0 0 0].

I wonder if the design matrix and contrasts are correct, especially the two columns corresponding to the interaction in the design matrix. Another way I think about it is to replace the 4th and 5th columns in the design matrix with 4th: [-1 1 0 1 -1 0]; 5th:[0 -1 1 0 1 -1]. Would that be right?

An additional question that I'm interested in is how can I analyze simple effects for my 3x2 within-subject design in NBS.

Looking forward to your reply!

Many thanks,
Shirley
Oct 15, 2019  12:10 AM | Andrew Zalesky
RE: Design matrix and contrasts for a 3x2 within-subject design
Hi Shirley,

Your design matrix and contrasts appear to be correct.

I do not really follow your description of the alternative way to test the interaction, but the main approach that you describe below is correct.

I would have formulated the design matrix as follows (but I think that this should be fully equivalent to your design matrix):

1 0 -1 -1 0 1 0 %(sub1 a1b1)
0 1 -1 0 -1 1 0 %(sub1 a2b1)
0 0 -1 0 0 1 0 %(sub1 a3b1)
1 0 1 1 0 1 0 %(sub1 a1b2)
0 1 1 0 1 1 0 %(sub1 a2b2)
0 0 1 0 0 1 0 %(sub1 a3b2)
1 0 -1 -1 0 0 1 %(sub2 a1b1)
0 1 -1 0 -1 0 1 %(sub2 a2b1)
0 0 -1 0 0 0 1 %(sub2 a3b1)
1 0 1 1 0 0 1 %(sub2 a1b2)
0 1 1 0 1 0 1 %(sub2 a2b2)
0 0 1 0 0 0 1 %(sub2 a3b2)

My only suggestion is that interpreting interaction effects for designs with >2 factors that each contain >2 levels can be challenging, particularly in the case of connectome inference. Therefore, if the interpretation becomes difficult, you may want to begin by simplifying your design (e.g. 2 x 2 design) by eliminating one of the levels.

Andrew



Originally posted by Junjun Li:
Dear Dr. Zalesky,

Thank you and your team so much for the wonderful tool! 

I've been working with the NBS toolbox with the help of the reference manual and the forum for several days. 
But I'm still not quite sure my design matrix and contrasts are right.

What I have is a 3x2 ANOVA with repeated measure on both factors. For simplicity, let me assume that there are only 2 subjects (Sub1, Sub2), and the factors are denoted by A(a1, a2, a3) and B (b1, b2), respectively. Both A (3 levels) and B (2 levels) are within-subject factors.

The design matrix that I constructed is:

1   0   0   1   0   1   0  (sub1 a1b1)
0   1   0   0   1   1   0  (sub1 a2b1)
0   0   0   0   0   1   0  (sub1 a3b1)
1   0   1  -1   0   1   0  (sub1 a1b2)
0   1   1   0  -1   1   0  (sub1 a2b2)
0   0   1   0   0   1   0  (sub1 a3b2)
1   0   0   1   0   0   1  (sub2 a1b1)
0   1   0   0   1   0   1  (sub2 a2b1)
0   0   0   0   0   0   1  (sub2 a3b1)
1   0   1  -1   0   0   1  (sub2 a1b2)
0   1   1   0  -1   0   1  (sub2 a2b2)
0   0   1   0   0   0   1  (sub2 a3b2)

The 1st and 2nd columns model the main effect of factor A.
The 3rd column is factor B.
The 4th and 5th columns model the AxB interaction.
The 6th and 7th columns model the two subjects.

To test for the the AxB interaction, I selected an F-test and contrast [0 0 0 1 1 0 0].
To test for the main effect of factor A, I selected an F-test and contrast [1 1 0 0 0 0 0].
And to test for the main effect of factor B, I selected an F-test and contrast [0 0 1 0 0 0 0].

I wonder if the design matrix and contrasts are correct, especially the two columns corresponding to the interaction in the design matrix. Another way I think about it is to replace the 4th and 5th columns in the design matrix with 4th: [-1 1 0 1 -1 0]; 5th:[0 -1 1 0 1 -1]. Would that be right?

An additional question that I'm interested in is how can I analyze simple effects for my 3x2 within-subject design in NBS.

Looking forward to your reply!

Many thanks,
Shirley
Oct 16, 2019  02:10 AM | Junjun Li
RE: Design matrix and contrasts for a 3x2 within-subject design
Dear Dr. Zalesky,

I would like to express my gratitude for your prompt reply and the helpful suggestion! It's been a timely and massive help.

Thank you again along with my best wishes.

Sincerely,
Shirley