help > Design matrix
Showing 1-7 of 7 posts
Display:
Results per page:
Dec 14, 2017  06:12 PM | Alexia Bourgeois - University of Geneva
Design matrix
Hi Andrew,

I'm just beginning with NBS. I went through the forum and the manual but I'm still confused regarding the design matrix.
I have two groups of subject: one group of stroke patients scanned 3 times (Time Point 1, 2, 3) and 1 group of controls scanned only once (TP1).

I would like to compare the 3 time points across my group of patients, I guess this correspond to one-way ANOVA within subject analysis.
In this case, should I create the following matrice, here presented for two subjects: (P for patients, T for time point)

P1T1 1 0 1 0
P2T1 0 1 1 0
P1T2 1 0 0 1
P2T2 0 1 0 1
P1T3 1 0 0 0
P2T3 0 1 0 0

Echange block: [1 2 1 2 1 2]
Contrast F test [0 0 1 1] to compare here T1 vs T2? 

Also Time point 1 and TP 3 are missing for two different patients. Should I remove these patients for this analysis?  

Then to compare patients vs controls, I guess I have to select paired of time points to obtain a 2x2 model.
In this case I obtain this matrix (C for control, P for patients, T for Time point)

C1T1 0 1 1 0 0 0
C1T2 1 0 1 0 0 0
C2T1 0 1 0 1 0 0
C2T2 1 0 0 1 0 0
P1T1 0 0  0 0 1 0
P1T2 1 1 0 0 1 0
P2T1 0 0 0 0 0 1
P2T2 1 1 0 0 0 1

The 1st column correspond to the main effect of time ->  F test - Contrast=[1 0 0 0 0 0] - Exchange blocks=[1 1 2 2 3 3 4 4]
The 2nd column correspond to the interaction between group x time -> t-test - Contrast=[0 -1 0 0 0 0] or [0 -1 0 0 0 0] - Exchange blocks=[1 1 2 2 3 3 4 4]
The fourth last columns correspond to the subject means. Should we automatically include it in the design matrix? What does it change?

Sorry for this long email but I'm quite lost! Thanks a lot in advance for your help and insights!

Regards,

Alexia
Dec 16, 2017  05:12 AM | Andrew Zalesky
RE: Design matrix
Hi Alexia,

If you have missing time points for just a few subjects, I suggest excluding these subjects. Other methods can also be used to deal with missing data points.

The F test contrast of [0 0 1 1] is not comparing T1 vs T2. It will compare T1 vs T2 vs T3. Specifically, it will test the null hypothesis of T1 = T2 = T3. The null will be rejected and a significant result returned when any of the three time points are different (not just T1 or T2).

Given that you only have controls scanned at one time point, I don't think your 2nd design matrix is correct. For example, what is the difference between C1T1 and C1T2? It seems you are making this design too complicated. You need to first define the null hypothesis that you want to test when you introduce the controls into the design. You could simply test for patient control difference at each of the three time points. I.e. run three identical analyses at each of the three time points.

Andrew

Originally posted by Alexia Bourgeois:
Hi Andrew,

I'm just beginning with NBS. I went through the forum and the manual but I'm still confused regarding the design matrix.
I have two groups of subject: one group of stroke patients scanned 3 times (Time Point 1, 2, 3) and 1 group of controls scanned only once (TP1).

I would like to compare the 3 time points across my group of patients, I guess this correspond to one-way ANOVA within subject analysis.
In this case, should I create the following matrice, here presented for two subjects: (P for patients, T for time point)

P1T1 1 0 1 0
P2T1 0 1 1 0
P1T2 1 0 0 1
P2T2 0 1 0 1
P1T3 1 0 0 0
P2T3 0 1 0 0

Echange block: [1 2 1 2 1 2]
Contrast F test [0 0 1 1] to compare here T1 vs T2? 

Also Time point 1 and TP 3 are missing for two different patients. Should I remove these patients for this analysis?  

Then to compare patients vs controls, I guess I have to select paired of time points to obtain a 2x2 model.
In this case I obtain this matrix (C for control, P for patients, T for Time point)

C1T1 0 1 1 0 0 0
C1T2 1 0 1 0 0 0
C2T1 0 1 0 1 0 0
C2T2 1 0 0 1 0 0
P1T1 0 0  0 0 1 0
P1T2 1 1 0 0 1 0
P2T1 0 0 0 0 0 1
P2T2 1 1 0 0 0 1

The 1st column correspond to the main effect of time ->  F test - Contrast=[1 0 0 0 0 0] - Exchange blocks=[1 1 2 2 3 3 4 4]
The 2nd column correspond to the interaction between group x time -> t-test - Contrast=[0 -1 0 0 0 0] or [0 -1 0 0 0 0] - Exchange blocks=[1 1 2 2 3 3 4 4]
The fourth last columns correspond to the subject means. Should we automatically include it in the design matrix? What does it change?

Sorry for this long email but I'm quite lost! Thanks a lot in advance for your help and insights!

Regards,

Alexia
Dec 19, 2017  11:12 AM | Alexia Bourgeois - University of Geneva
RE: Design matrix
Hi Andrew,

Thanks a lot for your very helpful answer!

Just to be sure, for the 2nd design, if I would like to test Controls vs Patients at each time points, is the following matrix ok?
(C for control, P for patients, T for Time-point, here for two controls and 2 patients and for Time point 1).

C1T1 1 0
C2T1 1 0
P1T1 0 1
P2T1 0 1

Contrast: [1 -1]
No need to exchange blocks?

Thanks again,
Have a nice day,

Alexia
Dec 20, 2017  05:12 AM | Andrew Zalesky
RE: Design matrix
Hi Alex,

yes - this is correct. No exchange block is required in this case because it is not a repeated measures design.

The contrast will test for controls > patients

If you change the contrast to [-1 1], you will instead test controls < patients.

Andrew
Originally posted by Alexia Bourgeois:
Hi Andrew,

Thanks a lot for your very helpful answer!

Just to be sure, for the 2nd design, if I would like to test Controls vs Patients at each time points, is the following matrix ok?
(C for control, P for patients, T for Time-point, here for two controls and 2 patients and for Time point 1).

C1T1 1 0
C2T1 1 0
P1T1 0 1
P2T1 0 1

Contrast: [1 -1]
No need to exchange blocks?

Thanks again,
Have a nice day,

Alexia
Nov 18, 2019  07:11 PM | Leonardo Tozzi
RE: Design matrix
I have a followup question on this topic, i.e. adding covariates of no interest in the design, such as age and sex.
I have a similar situation as what explained above:

P1T1 1 0 1 0
P2T1 0 1 1 0
P1T2 1 0 0 1
P2T2 0 1 0 1
P1T3 1 0 0 0
P2T3 0 1 0 0

Echange block: [1 2 1 2 1 2]
Contrast F test [0 0 1 1]

Now I would like to add age and sex as between subjects covariates. If I do as a design matrix:

P1T1 1 0 1 0 20 0
P2T1 0 1 1 0 30 1
P1T2 1 0 0 1 20 0
P2T2 0 1 0 1 30 1
P1T3 1 0 0 0 20 0
P2T3 0 1 0 0 30 1

Echange block: [1 2 1 2 1 2]
Contrast F test [0 0 1 1 0 0]

I get an error:
Warning: Rank deficient, rank = 839, tol = 1.242192e-09.

My question is, is it possible to have a between-subject covariate in such a design?
Thank you very much.
Nov 18, 2019  11:11 PM | Andrew Zalesky
RE: Design matrix
Hi Leonardo,

In this design you are modelling the mean of each subject independently.

Note that each subject's sex does not change between time points. If I am a male at time point 1, presumably I am still a male at time point 2. Therefore it does not make sense to include sex as a covariate in this kind of repeated measures design.

If you want to test hypotheses about sex, a repeated measures (multiple time points) is not necessary. You could simply average the data across the two time points if you are interested in a hypothesis about sex.

This is why you are getting the rank warning. The columns of the design matrix are not independent when sex is added.

The same is true for age in this case.


Andrew

Originally posted by Leonardo Tozzi:
I have a followup question on this topic, i.e. adding covariates of no interest in the design, such as age and sex.
I have a similar situation as what explained above:

P1T1 1 0 1 0
P2T1 0 1 1 0
P1T2 1 0 0 1
P2T2 0 1 0 1
P1T3 1 0 0 0
P2T3 0 1 0 0

Echange block: [1 2 1 2 1 2]
Contrast F test [0 0 1 1]

Now I would like to add age and sex as between subjects covariates. If I do as a design matrix:

P1T1 1 0 1 0 20 0
P2T1 0 1 1 0 30 1
P1T2 1 0 0 1 20 0
P2T2 0 1 0 1 30 1
P1T3 1 0 0 0 20 0
P2T3 0 1 0 0 30 1

Echange block: [1 2 1 2 1 2]
Contrast F test [0 0 1 1 0 0]

I get an error:
Warning: Rank deficient, rank = 839, tol = 1.242192e-09.

My question is, is it possible to have a between-subject covariate in such a design?
Thank you very much.
Nov 19, 2019  12:11 AM | Leonardo Tozzi
RE: Design matrix
Thank you very much for the quick reply!
I thought that somehow it was also possible to account for confounds across subjects. I will then disregard these variables and maybe look at them post-hoc.