help > ANCOVA rank deficient
Showing 1-15 of 15 posts
Display:
Results per page:
May 11, 2016  02:05 PM | Giulia Forcellini
ANCOVA rank deficient
Dear NBS' users,

I am running an analysis with two groups (HC and patients) where I want to control for age and gender. 
This is a short example of the matrix I am using to do so:

1 1 0 -1 0.5
1 1 0 1 -05
1 1 0 -1 0.5
1 0 1 1 -05
1 0 1 1 -05
1 0 1 -1 0.5

Where the first column is the intercept, the second column the first group, 3rd the second group, 4th column is gender and 5th age (demeaned).

My contrast would be [0 1 -1 0 0] running an F-test.

Now, when I run the analysis with these settings MATLAB gives me the following warning: 
Warning: Rank deficient, rank = 4, tol = 1.154632e-14.

Is it possible this is caused by the sample size being too small (HC=26, patients=26)?
What else could the problem be? How is it possible to solve this?

Thank you so much!

Best, 

Giulia
May 12, 2016  12:05 AM | Andrew Zalesky
RE: ANCOVA rank deficient
Hi Giulia,

Use the following design matrix
1 1 0  27
1 1 1  31
1 1 0  43
1 0 1  56
1 0 0  22
1 0 1  34

The 1st column is intercept, 2nd is patient or control; 3rd is gender and 4th is age.

To test for a between-group difference, use a "t-test" and the contrast:
[0 1 0 0]   
or
[0 -1 0 0]

The first one is patients > controls and the second is patients < controls.

Andrew



Originally posted by Giulia Forcellini:
Dear NBS' users,

I am running an analysis with two groups (HC and patients) where I want to control for age and gender. 
This is a short example of the matrix I am using to do so:

1 1 0 -1 0.5
1 1 0 1 -05
1 1 0 -1 0.5
1 0 1 1 -05
1 0 1 1 -05
1 0 1 -1 0.5

Where the first column is the intercept, the second column the first group, 3rd the second group, 4th column is gender and 5th age (demeaned).

My contrast would be [0 1 -1 0 0] running an F-test.

Now, when I run the analysis with these settings MATLAB gives me the following warning: 
Warning: Rank deficient, rank = 4, tol = 1.154632e-14.

Is it possible this is caused by the sample size being too small (HC=26, patients=26)?
What else could the problem be? How is it possible to solve this?

Thank you so much!

Best, 

Giulia
Aug 20, 2016  05:08 AM | Juan Pablo Princich - Neurociencias Hospital El Cruce, Buenos Aires
RE: ANCOVA rank deficient
Dear Andrew and Giulia
Thanks for the example , it is very useful.

Still have two questions maybe not related to NBS but to statistics in general that you could please kindly acknowledge...
1. under this ancova example , do we need to perform a multiple comparison correction if we perform any additional ttest on the same matrices but  with a different group definition ? in other words i found a significant network with this design but also want to look for differences re-arranging a sub group distribution according to clinical properties.. lets say i split the patients group in two and compare them with individual t test using the same design agaisnt all the controls.

2. is there a way to define a contrast that only shows the effect of covariates alone? (not accounting for the groups differences) or shall i modify the design matrix ?

Thanks for your patience and grateful help!
sincerely, Juan P
Aug 22, 2016  04:08 AM | Andrew Zalesky
RE: ANCOVA rank deficient
Hi Juan,

this is just like a typical F-test: you may want to perform subsequent testing to identify the groups that are driving the result. This can be done using independent t-tests, as you suggest, although there are more fancy ways of doing this. 

To test the significance of a single covariate, use a t-test and set the contrast vector equal to 1 in the position corresponding to the covariate. All other elements in the contrast vector should be zero. This will give you the significance of the covariate.


Andrew

Originally posted by Juan Pablo Princich:
Dear Andrew and Giulia
Thanks for the example , it is very useful.

Still have two questions maybe not related to NBS but to statistics in general that you could please kindly acknowledge...
1. under this ancova example , do we need to perform a multiple comparison correction if we perform any additional ttest on the same matrices but  with a different group definition ? in other words i found a significant network with this design but also want to look for differences re-arranging a sub group distribution according to clinical properties.. lets say i split the patients group in two and compare them with individual t test using the same design agaisnt all the controls.

2. is there a way to define a contrast that only shows the effect of covariates alone? (not accounting for the groups differences) or shall i modify the design matrix ?

Thanks for your patience and grateful help!
sincerely, Juan P
Dec 7, 2017  01:12 AM | Juan Pablo Princich - Neurociencias Hospital El Cruce, Buenos Aires
RE: ANCOVA rank deficient
Dear Andrew, 

I used NBS to compare 2 groups as stated in this post accounting for age and sex differences using a t-test, with a [0 1 0 0] contrast type as you suggest.
I found one component with 6 connection pairs that shall have higher connectivity in patients than in controls as the matrices were arranged in the same way as mentioned in this post (patients first followed by controls).

But i get confused interpreting results because when i extract the identified connections for all participants and perform individual tests (mann withney, non parametric)  on each connection pair between patients and controls , the values on patients are indeed significantly lower than in controls... contrary to the NBS results.


Will really appreciate your comments and possible explanations for this ambiguity.  Please be aware that age and sex effects are not regressed out for the individual connections test, but significance levels ares still very low (p.001).


Sincerely 
Juan P
Dec 7, 2017  01:12 AM | Andrew Zalesky
RE: ANCOVA rank deficient
You might want to check that you are interpreting the contrast correctly. If you code patients as 1 and controls as 0 (or -1), then the contrast of [0 1 0 0] will give patients greater than controls. Otherwise, if patients are coded as 0 (or -1) and controls as 1, then contrast [ 0 1 0 0] will give controls > patients. 

You might also want to check that your connectivity matrices are ordered correctly.



Originally posted by Juan Pablo Princich:
Dear Andrew, 

I used NBS to compare 2 groups as stated in this post accounting for age and sex differences using a t-test, with a [0 1 0 0] contrast type as you suggest.
I found one component with 6 connection pairs that shall have higher connectivity in patients than in controls as the matrices were arranged in the same way as mentioned in this post (patients first followed by controls).

But i get confused interpreting results because when i extract the identified connections for all participants and perform individual tests (mann withney, non parametric)  on each connection pair between patients and controls , the values on patients are indeed significantly lower than in controls... contrary to the NBS results.


Will really appreciate your comments and possible explanations for this ambiguity.  Please be aware that age and sex effects are not regressed out for the individual connections test, but significance levels ares still very low (p.001).


Sincerely 
Juan P
Dec 13, 2017  02:12 PM | Juan Pablo Princich - Neurociencias Hospital El Cruce, Buenos Aires
RE: ANCOVA rank deficient
Thanks for the quick response as usual.

Unfortunately the the coding looks correct.. first column intercept term, second patients (1) and controls (0), followed by one column for sex and the last accounting for age. ie..

1 1 1 31
1 1 1 24
1 1 0 50
1 1 1 30
1 0 1 24
1 0 1 24
1 0 1 25
1 0 1 34

If i followed you correctly the contras [0 1 0 0] shows higher connectivity in patients than controls.
I used the function (combine.m, kindly provided by you) to combine all subjects in a 4D matrix that were alphabetically ordered.. will recheck visually.

Is it possible to have some connection pairs showing higher connectivity values and at the same time others connections within the same component with lower values? or NBS should show separate components in that case?

Thanks again for your support!
Dec 18, 2017  11:12 AM | Juan Pablo Princich - Neurociencias Hospital El Cruce, Buenos Aires
RE: ANCOVA rank deficient
Solved.
Thanks, i just realised that matrices lost alphabetic order when compressed in a 3D stack,  because controls  filenames all started with a capital letter and all patients were low case names.
It resulted in an inverted order for the contrasts i 've used and consequently inverted results.

Just my 2 cents.

thanks for the advice.
JP
Sep 1, 2024  05:09 AM | Ru-Kai Chen - fujian medicial university
RE: ANCOVA rank deficient

Dear NBS' users
I am running an analysis were I want to control for age and sex.
My study design has two groups (patients and controls) and I would like to use age and gender as covariates to analyse the brain network connections that differ between the two groups
What about setting up that part of the design matrix which models the covariate in NBS like this (in the example I put 3 subjects per group)
1 1 0 34
1 1 1 53
1 1 1 23
1 0 0 60
1 0 1 35
1 0 1 23
The first column represents the constant, the second column is the group (1 for patient, 0 for control), the third column is the sex (1 for male, 0 for female), and the fourth column is the gender, which seems to be possible to design in this way as I looked through the forum discussions, but I don't know if it is correct or not
Finally how should I look at the main effect of the group and the choice of the test(two-sample t-test???)。
Thank you in advance for any kind of advice.
Kind regards
Chenrukai

Sep 1, 2024  06:09 AM | Andrew Zalesky
RE: ANCOVA rank deficient

Hi Ru-Kai,


I assume the 4th column is age (not gender). The design matrix looks fine. 


The main effect of group would be tested with the contrast of [0 1 0 0] or [0 -1 0 0]. Select two-sample t-test. 


If you really want to model both sex and gender separately, this may be difficult because sex and gender would probably be highly correlated, leading to rank issues in the design matrix. 


Andrew


Originally posted by Ru-Kai Chen:



Dear NBS' users
I am running an analysis were I want to control for age and sex.
My study design has two groups (patients and controls) and I would like to use age and gender as covariates to analyse the brain network connections that differ between the two groups
What about setting up that part of the design matrix which models the covariate in NBS like this (in the example I put 3 subjects per group)
1 1 0 34
1 1 1 53
1 1 1 23
1 0 0 60
1 0 1 35
1 0 1 23
The first column represents the constant, the second column is the group (1 for patient, 0 for control), the third column is the sex (1 for male, 0 for female), and the fourth column is the gender, which seems to be possible to design in this way as I looked through the forum discussions, but I don't know if it is correct or not
Finally how should I look at the main effect of the group and the choice of the test(two-sample t-test???)。
Thank you in advance for any kind of advice.
Kind regards
Chenrukai



 

Sep 1, 2024  09:09 AM | Ru-Kai Chen - fujian medicial university
RE: ANCOVA rank deficient

Dear Andrew


Thank you very much for your answer!


My intention is to use gender and age together as covariates, does this seem feasible?


 

Sep 1, 2024  10:09 PM | Andrew Zalesky
RE: ANCOVA rank deficient

Yes - that sounds reasonable. 


Originally posted by Ru-Kai Chen:



Dear Andrew


Thank you very much for your answer!


My intention is to use gender and age together as covariates, does this seem feasible?


 



 

Sep 4, 2024  11:09 AM | Ru-Kai Chen - fujian medicial university
RE: ANCOVA rank deficient

Dear Andrew


Thank you very much for your answer!


I seem to have a new problem.


When I use NBS to calculate significant connections, I find that at different thresholds, the NBS results file shows different numbers, either 3 or 1. Are they all connections that represent significance? Is there something wrong with this? (Figure below)
Very much looking forward to your answer?





Sep 4, 2024  11:09 AM | Andrew Zalesky
RE: ANCOVA rank deficient

Each of the three matrices represent a distinct network that was found to be signifcant.


It is possible for multiple networks to be signifciant - not just one. 


Originally posted by Ru-Kai Chen:



Dear Andrew


Thank you very much for your answer!


I seem to have a new problem.


When I use NBS to calculate significant connections, I find that at different thresholds, the NBS results file shows different numbers, either 3 or 1. Are they all connections that represent significance? Is there something wrong with this? (Figure below)
Very much looking forward to your answer?







 

Sep 4, 2024  11:09 AM | Ru-Kai Chen - fujian medicial university
RE: ANCOVA rank deficient

Dear Andrew


Thank you very much for your answer!


It seems that different cells represent different significant differences in connectivity(0.0002,0.0134,0.0048,0.0418)