help > RE: Help with design matrix and contrast for 4x3 model
Sep 3, 2021  11:09 PM | Andrew Zalesky
RE: Help with design matrix and contrast for 4x3 model
Hi Alexandra, 

the design matrix is over-parameterized and will give a rank deficient warning. You will need to remove one of the columns corresponding to site. So you should only need to model 3 of the 4 sites. It does not matter which site column is removed - the results will be the same irrespective of which site column is removed. Note that if you have information about 3 of the 4 sites, the identity of the 4th site can be inferred. 

If you have repeated measurements for all subjects and within-subject means are modelled, the first column of 1's (global mean) should also be removed. It wasn't clear to me if you have repeated measures for all subjects, or just a few. If you only have repeated measurements for a few subjects, the columns of 1's would still be needed. 

To test for an effect of site, you would use a contrast of the form [0 0 0 1 1 1 0 0 0 ....], where the 1's are positioned at the location of the three site variables. Use the F-test. Note that this will only test for a linear effect of size, and it is important to bear in mind that site effects can be non-linear. 

To test for a site-by-diagnosis interaction, you would need to add additional columns to your design matrix. The would involved multiplying (elementwise) the diagnosis and site columns to generate new regressors. 

best,
Andrew



Originally posted by Alexandra Anagnostopoulou:
Dear Dr. Zalesky,

I have a dataset that consists of 3 separate groups (HC,SZ,MDD) recorded in 4 different sites, measuring the conditions DL and DW (in total 131 subjects). I am trying to test the effect of the sites as well as their interaction with the diagnosis (with age and gender as covariates). My design matrix is:

Design Matrix
----------------
1 1 0 1 0 0 0 25 1 1 0 0 0
1 1 0 0 0 1 0 30 0 0 1 0 0
1 1 0 0 1 0 0 39 1 0 0 1 0
1 1 0 0 0 0 1 40 0 0 0 0 1
1 1 0 1 0 0 0 25 1 1 0 0 0
1 1 0 0 0 1 0 30 0 0 1 0 0

...

1 0 1 1 0 0 0 26 1 1 0 0 0
1 0 1 0 1 0 0 45 0 0 1 0 0
1 0 1 0 0 1 0 50 0 0 0 1 0
1 0 1 0 0 0 1 41 0 0 0 0 1
1 0 1 1 0 0 0 26 1 1 0 0 0
1 0 1 0 1 0 0 45 0 0 1 0 0
...

1 0 0 1 0 0 0 32 1 1 0 0 0
1 0 0 1 0 0 0 39 1 0 1 0 0
1 0 0 0 1 0 0 50 0 0 0 1 0
1 0 0 0 0 0 1 48 0 0 0 0 1
1 0 0 0 1 0 0 32 1 1 0 0 0
1 0 0 0 1 0 0 39 1 0 1 0 0

with the col 1: global mean, cols 2-3: group 1&2, cols 4-7: site 1-4, col 8: age, col 9: gender, remaining cols modelling observations from the same subject.

1. Is the design matrix correct for what I'm trying to test? Should I not include the last columns that mark the observations from the same subject? (Cause in a simple ANOVA (without sites-variables and covariates) I get a warning/error for rank reficient)


2. What is the appropriate contrast to test the differences between sites and/or the sites interaction with the diagnosis(group)?? Should it be along the lines of [0,1,-1,1,1,1,0...]?

Threaded View

TitleAuthorDate
Alexandra Anagnostopoulou Sep 3, 2021
RE: Help with design matrix and contrast for 4x3 model
Andrew Zalesky Sep 3, 2021
Alexandra Anagnostopoulou Sep 8, 2021
Andrew Zalesky Sep 9, 2021