help > modeling interaction with continuous predictors
Showing 1-8 of 8 posts
Display:
Results per page:
Dec 8, 2021  08:12 PM | Hamed Zivari
modeling interaction with continuous predictors
Dear NBS users

I am trying to model if the association of SC and Behavior is moderated by Age. So the model is SC ~ Age + Behavior + Age x Behavior interaction. Of note that both predictors are continuous.
I was wondering if the current GLM design and contrasts are correct? Is demeaning necessary?

1  age1_de   beh1_de   age1_de x beh1_de
1  age2_de   beh2_de   age2_de x beh2_de
.        .               .                      .
1  ageN_de  behN_de   ageN_de x behN_de

Contrast t-test=  [0  0  1] and [0 0 -1]
Contrast F-test= [0  0  1]

My next question is how to interpret and report the results since using the F-test one may find a significant subnetwork that includes edges with positive and negative interaction effects. Should I investigate every and each edge (which could be many) in the significant network to see the direction of effects or, eg., use the average connectivity across the significant network to perform this check (this perhaps makes more sense in the case of t-test)?

Thanks in advance for the help.

Best regards
Hamed
Dec 8, 2021  10:12 PM | Andrew Zalesky
RE: modeling interaction with continuous predictors
Hi Hamed, 

if you are only interested in the age x behavior interaction, there is no need to demean. The results will be the same with and without demeaning. But remember to include a column of 1's in your design matrix. (Note that this is not the case for the main effects.)

You are right about the F-test. An alternative is to consider two one-sided t-tests, as you have suggested. This will assist with parsing the direction of the effect. It is also possible to conduct a post hoc analysis investigating the direction of the effects. 

Andrew
Originally posted by Hamed Zivari:
Dear NBS users

I am trying to model if the association of SC and Behavior is moderated by Age. So the model is SC ~ Age + Behavior + Age x Behavior interaction. Of note that both predictors are continuous.
I was wondering if the current GLM design and contrasts are correct? Is demeaning necessary?

1  age1_de   beh1_de   age1_de x beh1_de
1  age2_de   beh2_de   age2_de x beh2_de
.        .               .                      .
1  ageN_de  behN_de   ageN_de x behN_de

Contrast t-test=  [0  0  1] and [0 0 -1]
Contrast F-test= [0  0  1]

My next question is how to interpret and report the results since using the F-test one may find a significant subnetwork that includes edges with positive and negative interaction effects. Should I investigate every and each edge (which could be many) in the significant network to see the direction of effects or, eg., use the average connectivity across the significant network to perform this check (this perhaps makes more sense in the case of t-test)?

Thanks in advance for the help.

Best regards
Hamed
Dec 22, 2021  11:12 AM | Marius Gruber
RE: modeling interaction with continuous predictors
Hello Andrew,
first of all thanks for the toolbox and also for your help here in the forum! I am using this thread from Hamed as my questions are on the same topic.

I am currently working on a study which aims to investigate the association between structural connectivity on one side and the interaction of two continuous variables x and z on the other side. We are interested in both the main effects of x and z and the interaction effect of x*z. So, after some research here on the forum, I have created the following design matrix that includes all three effects as well as several covariates. Our sample includes more than 900 subjects (MDD patients and HCs) from 3 study sites, and I z-standardized all continuous variables. For simplicity, I present only a subset of the data:
Intercept   Sex   Site_2   Site_3   Group_MDD   Age        X           Z            X*Z
1              0       0          0             1                     0.86      -1.86     -0.83       1.56
1              1       0          0             1                     0.16       1.10       1.17       1.30
1              1       0          0             0                    -0.83       2.59      -0.16     -0.42
1              0       1          0             0                     1.63      -0.46      -0.29      0.13
1              1       1          0             1                     1.55      -1.53      -0.17      0.26
1              1       0          1             1                    -1.30      -0.13      -1.17      0.15
1              0       0          1             0                    -0.99       1.02      -0.37     -0.38

Test: F-test

Contrasts:
Main effect X: [0,0,0,0,0,0,1,0,0]
Main effect Y: [0,0,0,0,0,0,0,1,0]
Interaction X*Y: [0,0,0,0,0,0,0,0,1]

I have the following questions regarding these analyses:
As I understand the above posts, I can test the interaction from X and Y with this design matrix and the contrast given above. If NBS finds a network, then the structural connectivity within that network is associated with the interaction effect of X and Y. Is this correct?

Can I reliably test the simple main effects of X and Y with this design matrix and the contrasts given above, or should I create new design matrices for this that include only the variables X or Y (without their interaction)?

To ease the interpretation of the identified networks, I would perform post-hoc t-tests, using the following contrasts:
Main effect X: [0,0,0,0,0,0,1,0,0] and [0,0,0,0,0,0,-1,0,0]
Main effect Y: [0,0,0,0,0,0,0,1,0] and [0,0,0,0,0,0,0,-1,0]
Interaction X*Y: [0,0,0,0,0,0,0,0,1] and [0,0,0,0,0,0,0,0,-1]

I would use sqrt(threshold of the F-test) as the threshold in each test.
Is it possible to test these effects using the t-tests?

Thanks for your help in advance!

Best,
Marius
Dec 22, 2021  09:12 PM | Andrew Zalesky
RE: modeling interaction with continuous predictors
Hi Marius, 


The design matrix appears to be correct and your assertions are also correct. 

You do not need to create a new design matrix to test for the main effects. The main effects can be tested using the same design matrix. However, the interpretation of the main effects in the presence of an interaction can change, compared to the case when the interaction effect is removed - this phenomenon is not specific to the NBS but a general property of linear models. I.e., the main effects will specifically relate to subjects which have the mean value of X and Z (which will be zero if you have standardized them) when the interaction effect is present. 

Yes - it is also possible to test all of these effects using t-tests. This would allow you to determine whether the association is positive or negative, as you have indicated. However, the F-test will reveal the direction of the association. 

You seem to be on the right track - good luck!

best,
Andrew
Originally posted by Marius Gruber:
Hello Andrew,
first of all thanks for the toolbox and also for your help here in the forum! I am using this thread from Hamed as my questions are on the same topic.

I am currently working on a study which aims to investigate the association between structural connectivity on one side and the interaction of two continuous variables x and z on the other side. We are interested in both the main effects of x and z and the interaction effect of x*z. So, after some research here on the forum, I have created the following design matrix that includes all three effects as well as several covariates. Our sample includes more than 900 subjects (MDD patients and HCs) from 3 study sites, and I z-standardized all continuous variables. For simplicity, I present only a subset of the data:
Intercept   Sex   Site_2   Site_3   Group_MDD   Age        X           Z            X*Z
1              0       0          0             1                     0.86      -1.86     -0.83       1.56
1              1       0          0             1                     0.16       1.10       1.17       1.30
1              1       0          0             0                    -0.83       2.59      -0.16     -0.42
1              0       1          0             0                     1.63      -0.46      -0.29      0.13
1              1       1          0             1                     1.55      -1.53      -0.17      0.26
1              1       0          1             1                    -1.30      -0.13      -1.17      0.15
1              0       0          1             0                    -0.99       1.02      -0.37     -0.38

Test: F-test

Contrasts:
Main effect X: [0,0,0,0,0,0,1,0,0]
Main effect Y: [0,0,0,0,0,0,0,1,0]
Interaction X*Y: [0,0,0,0,0,0,0,0,1]

I have the following questions regarding these analyses:
As I understand the above posts, I can test the interaction from X and Y with this design matrix and the contrast given above. If NBS finds a network, then the structural connectivity within that network is associated with the interaction effect of X and Y. Is this correct?

Can I reliably test the simple main effects of X and Y with this design matrix and the contrasts given above, or should I create new design matrices for this that include only the variables X or Y (without their interaction)?

To ease the interpretation of the identified networks, I would perform post-hoc t-tests, using the following contrasts:
Main effect X: [0,0,0,0,0,0,1,0,0] and [0,0,0,0,0,0,-1,0,0]
Main effect Y: [0,0,0,0,0,0,0,1,0] and [0,0,0,0,0,0,0,-1,0]
Interaction X*Y: [0,0,0,0,0,0,0,0,1] and [0,0,0,0,0,0,0,0,-1]

I would use sqrt(threshold of the F-test) as the threshold in each test.
Is it possible to test these effects using the t-tests?

Thanks for your help in advance!

Best,
Marius
Mar 10, 2022  04:03 PM | Selma Lugtmeijer - Brock University
RE: modeling interaction with continuous predictors
Hi,

this post and the reply have been of great help! 

I do have a question concerning the F-value for the threshold in this situation. How do you calculate which F-value is significant at p < .01 when testing in 1 group the effects of age, behaviour, and their interaction?

The T-value I am using is 2.622 based on a significance level of < .01 and a DF of 110 (111 subjects). Is that correct? 

Many thanks,
Selma
Mar 11, 2022  07:03 AM | Andrew Zalesky
RE: modeling interaction with continuous predictors
Hi Selma, 

I am not sure if I understand your question. A t-value can be converted to an f-value by squaring the t-value. That is, f = t^2. 

Significance is computed internally using permutation testing and it is not possible to determine a priori the f-value that will yield a significant result. 

Andrew

Originally posted by Selma Lugtmeijer:
Hi,

this post and the reply have been of great help! 

I do have a question concerning the F-value for the threshold in this situation. How do you calculate which F-value is significant at p < .01 when testing in 1 group the effects of age, behaviour, and their interaction?

The T-value I am using is 2.622 based on a significance level of < .01 and a DF of 110 (111 subjects). Is that correct? 

Many thanks,
Selma
Mar 11, 2022  07:03 AM | Selma Lugtmeijer - Brock University
RE: modeling interaction with continuous predictors
Hi,

thank you for the quick reply and apologies for not being clear. I hope I can clarify. I did not mean to ask what F-value would give me significant results. My question is on how to determine the F-value threshold. I thought that I could put in the F-value that with my sample size would correspond to a p-value of .01. Maybe my logic is erroneous but for every F-score + numerator + denominator you can calculate the corresponding p-value, so to determine which F-value to put in as threshold I thought to take the F-value that for my sample size corresponds to a p-value of .01. Is it correct to do it like this or is there some other guidance for what value to put there?

Selma
Mar 11, 2022  09:03 PM | Andrew Zalesky
RE: modeling interaction with continuous predictors
Hi Selma, 


yes you are right. If you have the degrees of freedom of the numerator and denominator, the F-value threshold can be easily computed. For example, in Matlab, we can use finv(1-0.01,v1,v2), where v1 and v2 are the degrees of freedom of the numerator and denominator. 

Some researchers struggle with determining the degrees of freedom. Usually, v1 is the number of independent predictors in your model and v2 is the sample size minus the total number of predictors. 

For example, for p=0.01, if we have 5 predictors and a sample size of 100, we have 

F = finv(1-0.01,5,100-5) = 3.22

Note that the exact degrees of freedom may depend on the specifics of the model. 

best,
Andrew
Originally posted by Selma Lugtmeijer:
Hi,

thank you for the quick reply and apologies for not being clear. I hope I can clarify. I did not mean to ask what F-value would give me significant results. My question is on how to determine the F-value threshold. I thought that I could put in the F-value that with my sample size would correspond to a p-value of .01. Maybe my logic is erroneous but for every F-score + numerator + denominator you can calculate the corresponding p-value, so to determine which F-value to put in as threshold I thought to take the F-value that for my sample size corresponds to a p-value of .01. Is it correct to do it like this or is there some other guidance for what value to put there?

Selma