help > How to write design matrix and contrast for continuous variable analysis (not comparison between groups)
Showing 1-6 of 6 posts
Display:
Results per page:
Jul 20, 2021  08:07 PM | Qiushi Wang
How to write design matrix and contrast for continuous variable analysis (not comparison between groups)
Hello everyone,
I have checked the manual and the forum posts, as I am not doing comparison between groups or longitudinal analysis ( I do continuous variable analysis use cross-sectional data), so I am a little confused about the writing of design matrix and contrast.
I used a set of cross-sectional data to explore which edges in the FC matrix had significant age effects. Specifically:
I have a group of subjects with different ages (suppose 5 people), and I want to examine which edges develop significantly with age (subjects are not divided in to groups but put together). Meanwhile, sex and FD are used as covariates. How should I write design matrix and contrast?
In addition, I have two simple questions and I'm not so confident about: (1) Dose the value filled in the “Threshold” box a T statistic? For example, if I have 5 subjects and I want to identify the significant edges at p=0.01, according to df=5 and p=0.01, 4.032 should be filled in here. If I want p=0.001 as the significance level for the edges, then 6.869? (2) Does the value filled in the "Significance" box correspond to the P value of the Component (not the P value for the edge)?
Thank you very much!

Best wishes
Qiushi
Jul 20, 2021  11:07 PM | Andrew Zalesky
RE: How to write design matrix and contrast for continuous variable analysis (not comparison between groups)
Hi Qiushi,

This kind of design should be straightforward. You would simply include a column with the age of each subject, and two additional columns for sex and FD. An additional column containing all 1's may also be needed. That's it. The contrast would be [1 0 0 0] or [-1 0 0 0] and select "t-test".

Yes the value in the threshold box is a t-statistic (or F-statistic in the case of the F-test). Your calculations seem correct. 

Yes the significance box is for the the component, not for the edge. 

best,

Andrew

Originally posted by Qiushi Wang:
Hello everyone,
I have checked the manual and the forum posts, as I am not doing comparison between groups or longitudinal analysis ( I do continuous variable analysis use cross-sectional data), so I am a little confused about the writing of design matrix and contrast.
I used a set of cross-sectional data to explore which edges in the FC matrix had significant age effects. Specifically:
I have a group of subjects with different ages (suppose 5 people), and I want to examine which edges develop significantly with age (subjects are not divided in to groups but put together). Meanwhile, sex and FD are used as covariates. How should I write design matrix and contrast?
In addition, I have two simple questions and I'm not so confident about: (1) Dose the value filled in the “Threshold” box a T statistic? For example, if I have 5 subjects and I want to identify the significant edges at p=0.01, according to df=5 and p=0.01, 4.032 should be filled in here. If I want p=0.001 as the significance level for the edges, then 6.869? (2) Does the value filled in the "Significance" box correspond to the P value of the Component (not the P value for the edge)?
Thank you very much!

Best wishes
Qiushi
Jul 21, 2021  09:07 AM | Qiushi Wang
RE: How to write design matrix and contrast for continuous variable analysis (not comparison between groups)
Hi Andrew,

I am very glad to receive your prompt reply. I'll give it a try. 
Thank you very much.

best wishes

Qiushi
Aug 31, 2021  05:08 PM | Ben Sipes - University of California, San Francisco
RE: How to write design matrix and contrast for continuous variable analysis (not comparison between groups)
Hi all,

@Andrew, thank you for contribution to NBS and answering questions on this forum!! 

I have some follow-up questions to this thread to help me better understand the design matrix and contrast construction for continuous variables.

Let's say I have connectome data from N subjects as well as behavioral data from each subject as a continuous variable, then I want to ask whether there is some connected subgraph with edge strengths that linearly increase with the behavioral measure across subjects.

As I understand it, I should create an Nx2 design matrix, where the first column is a constant [ones(N,1)], and the second column is the demeaned continuous behavioral measure. Then the contrast vector would be [0 1] to find a linearly increasing connected subgraph (via NBS), and the statistical test would be "t-test." Conversely, if the question asked about a linearly decreasing subgraph, then the contrast vector would instead be [0 -1]. Is this baseline intuition correct?

Next, I would like to ask the same question, but control for two covariates, age and sex. I believe I should then have an Nx4 design matrix, with a constant (first column), demeaned behavioral measure (second column), and demeaned age and demeaned sex (third and fourth columns, respectively). Then would the associated contrast vector be [0 1 0 0]? Or would it instead be [0 1 1 1]? Are there valid but different interpretations for both of these contrasts? Is the appropriate statistical test still "t-test?"

Thank you so much for your help with this question!

--Ben
Sep 1, 2021  12:09 AM | Andrew Zalesky
RE: How to write design matrix and contrast for continuous variable analysis (not comparison between groups)
Hi Ben, 

yes - the baseline intuition is correct. 

In the case of covariates, the relevant contrast is [0 1 0 0] or [0 -1 0 0] to test for an association with the behavioral data, and the test is still t-test. 

Using [0 1 1 1] would not be correct here. This contrast does not have a straightforward interpretation and would not be used typically. 

I hope that helps!
Andrew



Originally posted by Ben Sipes:
Hi all,

@Andrew, thank you for contribution to NBS and answering questions on this forum!! 

I have some follow-up questions to this thread to help me better understand the design matrix and contrast construction for continuous variables.

Let's say I have connectome data from N subjects as well as behavioral data from each subject as a continuous variable, then I want to ask whether there is some connected subgraph with edge strengths that linearly increase with the behavioral measure across subjects.

As I understand it, I should create an Nx2 design matrix, where the first column is a constant [ones(N,1)], and the second column is the demeaned continuous behavioral measure. Then the contrast vector would be [0 1] to find a linearly increasing connected subgraph (via NBS), and the statistical test would be "t-test." Conversely, if the question asked about a linearly decreasing subgraph, then the contrast vector would instead be [0 -1]. Is this baseline intuition correct?

Next, I would like to ask the same question, but control for two covariates, age and sex. I believe I should then have an Nx4 design matrix, with a constant (first column), demeaned behavioral measure (second column), and demeaned age and demeaned sex (third and fourth columns, respectively). Then would the associated contrast vector be [0 1 0 0]? Or would it instead be [0 1 1 1]? Are there valid but different interpretations for both of these contrasts? Is the appropriate statistical test still "t-test?"

Thank you so much for your help with this question!

--Ben
Sep 1, 2021  01:09 AM | Ben Sipes - University of California, San Francisco
RE: How to write design matrix and contrast for continuous variable analysis (not comparison between groups)
Hi Andrew,

This was very helpful! Thank you so much for your response and for being a resource on this forum!!

Best of luck with all your work!
--Ben