3dMVM interaction between two continous variables

AFNI version info (afni -ver): 23.1.08

Dear AFNI experts,

I'm trying to compute interaction results using 3dMVM. The interaction term is consisted of two continuous variables (age and vo2). I also would like to adjust the model with covariates (sex and education). I tried the below script to run this.

3dMVM -prefix vo2_age_inter \
-qVars 'vo2,age,sex,edu' \
-bsVars 'vo2' \
-num_glt 1 \
-gltLabel 1 'vo2*age' -gltCode 1 'vo2: age:' \
-mask mask.nii.gz \
-dataTable \
Subj	vo2	age	sex	edu	InputFile	\
1	27	68	0	20	subj1.nii.gz	\
2	33.2	56	1	13	subj2.nii.gz	\
3	24.6	65	0	18	subj3.nii.gz	\
.
.
.

However, it showed the below error.

Error in if (is.na(code[[n]][QVpos + 2])) { :
the condition has length > 1
Calls: process.MVM.opts -> gl_Constr
Execution halted

Could you please advise what was not correctly done here? Thank you in advance for your help.

Best,
JW

I suggest adopting the following steps:

  1. Consider centering those quantitative variables if necessary. The option -qVarCenters may be useful.
  2. Create the variable for the interaction between vo2 and age with the product of the two centered variables (e.g., call it va).
  3. Modify your 3dMVM script
3dMVM -prefix vo2_age_inter        \
-qVars 'vo2,age,va,sex,edu'        \
-bsVars 'vo2+age+va+sex+edu'       \
-num_glt 1                         \
-gltLabel 1 'va' -gltCode 1 'va :' \
-mask mask.nii.gz                  \
-dataTable                         \
Subj vo2 age va sex edu InputFile  \
...

Hi Gang,

Thank you so much for the suggestion. Could you please clarify for the 2 that the product of vo2 and age should be the multiplied value of the two variables?

Best,
JW

Could you please clarify for the 2 that the product of vo2 and age should be the multiplied value of the two variables?

Yes, after you center the two variables.

Gang