3dMVM Interaction Question

Dear AFNI experts,

I am analyzing a cross-sectional data and ran a multiple linear regression using a variable called 'fit' as a predictor while adjusting for covariates using 3dMVM script below.

3dMVM -prefix fit_regression \
-qVars 'age,sex,edu,bmi,sbp,gs,fit' \
-bsVars 'fit' \
-num_glt 1 \
-gltLabel 1 'fit' -gltCode 1 'fit:' \
-mask mask_final+tlrc \
-dataTable \
Subj age sex edu bmi sbp gs fit InputFile \
subj1 27 1 16 26 119 1.24 123.31 subj1_r2z+tlrc \
subj2 27 0 16 22 117 1.58 114.05 subj2_r2z+tlrc \
subj3 33 1 16 27 152 1.51 121 subj3_r2z+tlrc \
subj4 27 1 16 36 141 1.1 107.24 subj4_r2z+tlrc \
.
.
.

I then would like to run interaction between sex and fit. Could you please advise how the script should be modified to obtain the interaction between sex and fit?

Best,
JW

In your -bsVars line you would specify the interaction by changing it to this:

-bsVars 'fit*sex'

Hi aloijm,

Thanks! Could you please check if the gltLabel looks ok? fit is a continuous variable.

3dMVM -prefix sex-fit_inter \
-qVars 'age,sex,edu,bmi,sbp,gs,fit' \
-bsVars 'fit*sex' \
-num_glt 1 \
-gltLabel 1 'fit*sex' -gltCode 1 'fit : sex: 1*male -1*female' \

Best,
JW

JW,

  1. If the GLT is the focus of your analysis, I suggest that you simplify your model from
-qVars 'age,sex,edu,bmi,sbp,gs,fit' \
-bsVars 'fit*sex' \

to

-qVars 'fit' \
-bsVars 'fit*sex' \

Tossing all available variables into a model is not necessarily a good idea, especially when their logic relationships are not clearly sorted out.

  1. Read this discussion, and decide whether you should center fit.

  2. The GLT should be specified as

-gltLabel 1 'fit*sex' -gltCode 1 'sex : 1*male -1*female fit :' \

Gang

Hi Gang,

Thank you so much! If I want to still add age,edu,bmi,sbp,gs as covariates, could you please advise how to do?

Best,
JW

JW,

Incorporating the covariate fit already introduces a significant level of complexity. A regression model entails more intricacies than those typically covered in conventional textbooks. Therefore, it is important to exercise caution when considering additional covariates unless all interrelationships are thoroughly understood and clearly delineated. Given that I have no knowledge about the nature of those variables, it is difficult for me to provide specific suggestions at this time.

Gang

Hi Gang,

Thank you for the explanation!

I ran the below script as you suggested.

3dMVM -prefix sex_fit_inter \
-qVars 'fit' \
-bsVars 'fit*sex' \
-num_glt 1 \
-gltLabel 1 'fit*sex' -gltCode 1 'sex : 1*male -1*female fit :' \

And, it showed the error below. Could you please advise what could be an issue here?

updating R_LD_LIBRARY_PATH ...
Error in outList[[1]][[n]] : subscript out of bounds
Calls: process.MVM.opts -> gl_Constr
Execution halted

Best,
JW

JW,

Update your AFNI:

@update.afni.binaries -d

Let us know if the problem persists.

Gang

Hi Gang,

It still shows the error below after the update.

updating R_LD_LIBRARY_PATH ...
Error in outList[[1]][[n]] : subscript out of bounds
Calls: process.MVM.opts -> gl_Constr
Execution halted

Best,
JW

JW, I sent you an email and requested that you share a testing dataset for diagnosis.

I was able to solve this issue thanks to Gang's help. For those who might experience the same issue, the main issue for this thread was that I put 1 and -1 for the variable 'sex'. However, it should be either male or female under datatable.

Also, I had no packaged called 'afex' installed.

updating R_LD_LIBRARY_PATH ...
Error in library("afex") : there is no package called ‘afex’
Execution halted

So I ran rPkgsInstall -pkgs ALL which installed all the packages. After that, I ran the 3dMVM script and it is running.

Thanks again for Gang for all the help!

Best,
JW

1 Like