help > Design matrix
Showing 1-3 of 3 posts
Display:
Results per page:
Mar 29, 2017  02:03 AM | Xiaonan Guo
Design matrix
Dear Andrew,
Thanks for the awesome toolbox. Recently I'm conducting an  ANOVA analysis with two groups using the NBSglm function where I would like to examine the effects of age on these two groups. Additionally. gender should be taken as covariates in the model.
Here is a short example of my design matrix:
1  0.5  0.5  -1  1
1  -0.5  -0.5 -1  1
1  -0.5  -0.5 1  1
-1 0.5  -0.5  1  1
-1 0.5   -0.5  -1  1
-1 -0.5  0.5  -1  1
Where the first column is the group, the second column the demeaned age, 3rd the interaction effect between group and age, 4th column is gender and 5th the intercept.
My F contrasts would be [1 0 0 0 0],[0 1 0 0 0],[0 0 1 0 0] for main effects of group and age and interaction effect, respectively.
I'm wondering whether my design and contrast matrices are correct or not. Could you please tell whether my understanding is correct?

Best,
Xiaonan
Mar 29, 2017  04:03 AM | Andrew Zalesky
RE: Design matrix
Hi Xiaonan,

The contrasts look correct.

You can also use a t-test for each of the three contrasts as well. In the case of the t-test, you may want to replace the 1 in the contrast vector with -1, depending on the sign of the alternative hypothesis.

To add gender as a co-variate, simply add an extra column where gender is encoded with 1 and 0. 

Andrew

Originally posted by Xiaonan Guo:
Dear Andrew,
Thanks for the awesome toolbox. Recently I'm conducting an  ANOVA analysis with two groups using the NBSglm function where I would like to examine the effects of age on these two groups. Additionally. gender should be taken as covariates in the model.
Here is a short example of my design matrix:
1  0.5  0.5  -1  1
1  -0.5  -0.5 -1  1
1  -0.5  -0.5 1  1
-1 0.5  -0.5  1  1
-1 0.5   -0.5  -1  1
-1 -0.5  0.5  -1  1
Where the first column is the group, the second column the demeaned age, 3rd the interaction effect between group and age, 4th column is gender and 5th the intercept.
My F contrasts would be [1 0 0 0 0],[0 1 0 0 0],[0 0 1 0 0] for main effects of group and age and interaction effect, respectively.
I'm wondering whether my design and contrast matrices are correct or not. Could you please tell whether my understanding is correct?

Best,
Xiaonan
Mar 29, 2017  09:03 AM | Xiaonan Guo
RE: Design matrix
Dear Andrew,
Thanks for your kind help!

Best wishes,
Xiaonan