help

help >

**RE: How to write design matrix and contrast for continuous variable analysis (not comparison between groups)**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

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

@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

## Threaded View

Title | Author | Date |
---|---|---|

Qiushi Wang |
Jul 20, 2021 | |

Ben Sipes |
Aug 31, 2021 | |

Andrew Zalesky |
Sep 1, 2021 | |

Ben Sipes |
Sep 1, 2021 | |

Andrew Zalesky |
Jul 20, 2021 | |

Qiushi Wang |
Jul 21, 2021 | |