getting error in 3dMVM run

I am new to AFNI and I am trying to run the script:

3dMVM -prefix Output_3dMVM -jobs 4 \
-bsVars 'BI*NC'\
-qVars 'BI' \
-mask BrainMask_MNI_222.nii \
-dataTable
Subj	BI	NC	InputFile \
S0229	29.34	0.00	S0229_r1_larc_Z+orig \
S0230	39.02	7.00	S0230_r1_larc_Z+orig \
S0232	33.00	0.00	S0232_r1_larc_Z+orig \
S0237	23.50	3.00	S0237_r1_larc_Z+orig \

I want to do the interaction analysis for BI and NC and want to see the effect on resting data

Error in if (len%%wd != 0) errex.AFNI(paste("The content under -dataTable is not rectangular !",  :
  argument is of length zero
Calls: process.MVM.opts
Execution halted
./3dmvm_trial2.sh: line 2: -bsVars: command not found
./3dmvm_trial2.sh: line 3: -qVars: command not found
./3dmvm_trial2.sh: line 4: -mask: command not found
./3dmvm_trial2.sh: line 5: $'-dataTable\r': command not found
./3dmvm_trial2.sh: line 6: Subj: command not found
./3dmvm_trial2.sh: line 7: S0229: command not found
./3dmvm_trial2.sh: line 8: S0230: command not found

Which version of AFNI are you currently using? You can check this by running the command afni -ver. I suggest updating to the latest version, as this might help diagnose the issue you're encountering.

If the variable NC is quantitative, you should modify the following line:

-qVars 'BI' \

to

-qVars 'BI,NC' \

The errors you're seeing are likely due to extra spaces after the backslashes (\) in your script.

Gang Chen

Hello,

The "command not found" errors mean there are not proper newline (\) characters applied. Make sure there are no spaces or tabs after the \ characters. Also, It is better to have a space before the \. Or at least if you don't, then start the next line with space before the next option.
e.g. consider starting with:

3dMVM                                 \
    -prefix     Output_3dMVM          \
    -jobs       4                     \
    -bsVars     'BI*NC'               \
    -qVars      'BI'                  \        
    -mask       BrainMask_MNI_222.nii \
    -dataTable                        \            
Subj  BI    NC   InputFile            \
S0229 29.34 0.00 S0229_r1_larc_Z+orig \

And of course apply Gang's suggestions...

  • rick

Thank you Gang and Rick

I have fixed this issue now I am getting another error:
Dimensions:
rows: 10 | columns: 5

Data summary:
Variable Detected_Type Details
Subj Subjects Num Subjects=102
Group Categorical Counts: patient=102
BI Quantitative Min=18.5 | Max=86.84 | Num outliers=1
NC Quantitative Min=0 | Max=8 | Num outliers=3
InputFile Data Number of InputFiles=10

++ Good: All InputFiles exist.

++ Good: All InputFiles have exactly 1 volume.

++ Good: All InputFiles are on the same grid.

+* Warning: Log file: ./Output_3dMVM_log.txt exists! NOT OVERWRITING!!

** Error:
Inappropriate coding in test No.1!

My Script is :

3dMVM -prefix Output_3dMVM -jobs 4
-bsVars "GroupBMI+NIC"
-qVars "BMI,NIC"
-qVarCenters '29.4048,1.794118'
-mask BrainMask_MNI_222.nii
-num_glt 5
-gltCode '1' 'BI_vs_NC : BI +1
NIC -1'
-gltCode '2' 'BI_main : BI +1'
-gltCode '3' 'NC_main : NC +1'
-gltCode '4' 'BI_NC_interaction : Group:BI:NC 1'
-gltCode '5' 'BI_NC_additive : BI+NC'
-dataTable
'Subj' 'Group' BI' NC' 'InputFile'
'S0229' 'patient' 29.34 0 'S0229_r1_larc_Z+orig'
'S0230' 'patient' 39.02 7 'S0230_r1_larc_Z+orig'
'S0232' 'patient' 33 0 'S0232_r1_larc_Z+orig' \

Now the error:
Dimensions:
rows: 102 | columns: 5

Data summary:
Variable Detected_Type Details
Subj Subjects Num Subjects=102
Group Categorical Counts: patient=102
BMI Quantitative Min=18.5 | Max=86.84 | Num outliers=1
NIC Quantitative Min=0 | Max=8 | Num outliers=3
InputFile Data Number of InputFiles=102

++ Good: All InputFiles exist.

++ Good: All InputFiles have exactly 1 volume.

++ Good: All InputFiles are on the same grid.

+* Warning: Log file: ./Output_3dMVM_log.txt exists! NOT OVERWRITING!!

** Error:
Inappropriate coding in test No.1!

My Script

3dMVM -prefix Output_3dMVM -jobs 4 \
-bsVars "Group*BMI+NIC" \
-qVars "BMI,NIC" \
-qVarCenters '29.4048,1.794118' \
-mask BrainMask_MNI_222.nii \
-num_glt 5 \
-gltCode '1' 'BMI_vs_NIC : BMI +1*NIC -1' \
-gltCode '2' 'BMI_main : BMI +1' \
-gltCode '3' 'NIC_main : NIC +1' \
-gltCode '4' 'BMI_NIC_interaction : Group:BMI:NIC 1' \
-gltCode '5' 'BMI_NIC_additive : BMI+NIC' \
-dataTable \
'Subj'	'Group'	BMI'	NIC'	'InputFile' \
'S0229'	'patient'	29.34	0	'S0229_r1_larc_Z+orig' \
'S0230'	'patient'	39.02	7	'S0230_r1_larc_Z+orig' \
'S0232'	'patient'	33	0	'S0232_r1_larc_Z+orig' \

Does -qVars need to come before -bsVars, so that the variables are defined first? I am not sure how the options are parsed in 3dMVM...

  • rick

I have followed the AFNI link and I have followed an example:

3dMVM -prefix Example2 -jobs 24        \
          -mask myMask+tlrc               \
          -bsVars  "genotype*sex+age+IQ"  \
          -wsVars emotion                \
          -qVars  "age,IQ"               \
          -qVarCenters '25,105'          \
          -num_glt 10                    \
          -gltLabel 1 pos_F_vs_M   -gltCode 1 'sex : 1*female -1*male emotion : 1*pos'          \
          -gltLabel 2 age_pos_vs_neg -gltCode 2 'emotion : 1*pos -1*neg age :'                  \
          -gltLabel 3 age_pos_vs_neg -gltCode 3 'emotion : 1*pos -1*neg age : 5'                \
          -gltLabel 4 genotype_by_sex -gltCode 4 'genotype : 1*TT -1*NN sex : 1*male -1*female' \
          -gltLabel 5 genotype_by_sex_emotion -gltCode 5 'genotype : 1*TT -1*NN sex : 1*male -1*female emotion : 1*pos -1*neg' \
          ...
          -dataTable                                                                   \
          Subj  genotype  sex    age  IQ     emotion   InputFile                       \
          s1    TT         male   24   107    pos       s1+tlrc'[pos_beta]'            \
          s1    TT         male   24   107    neg       s1+tlrc'[neg_beta]'            \
          s1    TT         male   24   107    neu       s1+tlrc'[neu_beta]'            \
          ...
          s63   NN         female 29   110    pos       s63+tlrc'[pos_beta]'           \
          s63   NN         female 29   110    neg       s63+tlrc'[neg_beta]'           \
          s63   NN         female 29   110    neu       s63+tlrc'[neu_beta]'

There are a couple of problems with the 3dMVM script. It seems that you only have one group; thus, it does not make sense to include Group in your model specification. Second, among the five effect specifications, the first and the fifth are not estimable while the other three are not properly specified. If you want to estimate the interaction between the two quantitative variables, center the them first, and create another variable (e.g., call it inter) as the product of the two. Then, try the following (make sure both BMI and NIC are centered in your data table):

...
-bsVars "BMI+NIC+inter" \
-qVars "BMI,NIC,inter" \
-qVarCenters '0,0,0' \
...
-num_glt 3 \
-gltLabel 1 BMI_main -gltCode 1  'BMI :' \
-gltLabel 2 NIC_main -gltCode 2 'NIC :' \
-gltLabel 3 BMI_NIC_interaction -gltCode 3 'inter :' \

Gang Chen

Thank you, Gang Chen.
I have only concern about the warnings and the last two things that need to know about
how can I do the additive effect of BMI and NIC.
how can I add the group in gltcode if I have two groups

What is the relationship between BMI and NIC? Does one affect the other?

Are the current results aligning with your expectations?

The first warning about centering can be disregarded if you’ve already centered both BMI and NIC in your data table. The second warning regarding columns may stem from the unused 'Group' column.

how can I do the additive effect of BMI and NIC.

Are you referring to the combined effect of BMI and NIC?

how can I add the group in gltcode if I have two groups

You can refer to the 3dMVM help section on factor specification. Feel free to share your current setup if you need clarification or further assistance.

Gang Chen

Thank you Gang,

You are right I am referring to the combined effect of BMI and NIC

Again, what is the relationship between BMI and NIC? Does one affect the other?

Generally, it does not make sense to combine the effects of BMI and NIC in a single estimate, as they are measured in different units and represent distinct physical aspects.

Gang Chen

Got you that make sense.

Thank you Gang for your help and suggestions

when i am running 3dttest++ I am getting results but with 3dMVM it not. Any suggestion please

Could you share the main content of the 3dttest++ and 3dMSS scripts?

Gang Chen

3dmvm:

3dMVM -prefix Output_centered_bmi_nic_inter1_r9_left_left_hypothalamus_3dMVM -jobs 3
-bsVars 'BMI+NIC+inter'
-qVars 'BMI,NIC,inter'
-qVarCenters '29.4048,1.79,1.94'
-mask BrainMask_MNI_222.nii
-num_glt 3
-gltLabel 1 'BMI_main' -gltCode 1 'BMI :'
-gltLabel 2 'NIC_main' -gltCode 2 'NIC :'
-gltLabel 3 'BMI_NIC_interaction' -gltCode 3 'inter :'
-dataTable
Subj Group BMI_centered NIC_centered inter InputFile
S0229 patient -0.06 -1.79 0.12 S0229_r9_left_hypothalamus_Z+orig
S0230 patient 9.62 5.21 50.06 S0230_r9_left_hypothalamus_Z+orig
S0232 patient 3.60 -1.79 -6.45 S0232_r9_left_hypothalamus_Z+orig
S0237 patient -5.90 1.21 -7.12 S0237_r9_left_hypothalamus_Z+orig
S0266 patient -4.93 -1.79 8.85 S0266_r9_left_hypothalamus_Z+orig
S0277 patient -5.96 -1.79 10.70 S0277_r9_left_hypothalamus_Z+orig \

3dttest:

3dttest++ -prefix patient_bmi_nic_interaction_6thsep_r9_left_hypothalamus
-covariates bmi_nic_6thsep.txt
-mask BrainMask_MNI_222.nii.gz
-center DIFF
-setA S0229_r9_left_hypothalamus_Z+orig
S0230_r9_left_hypothalamus_Z+orig
S0232_r9_left_hypothalamus_Z+orig
S0237_r9_left_hypothalamus_Z+orig \

Note: the values for qvars in 3dttest were given as .txt file but they were same as 3dmvm.

I have one more concern that the result from either of them are not look like interaction effect. I tried to plot tye result and it looks correlation than interaction effect.

Hi Gang Chen,

The correlation of BMI and NIC is 0.337.

As you are said the variable are in different units but now, they have been centered.

We are trying to do the linear regression model effect

Y = BMI + NIC

The correlation of BMI and NIC is 0.337.

It would be more informative if you could clarify the direction of influence: is it BMI → NIC, or NIC → BMI?

-qVarCenters '29.4048,1.79,1.94'

The 3dMVM script was not set up correctly, as my previous suggestions were not fully followed. Here are the necessary steps:

  1. Center both BMI and NIC.
  2. Create an interaction term by multiplying the two centered variables.
  3. Include the centered values and their interaction in the data table.
  4. Add the following line to the script:
    -qVarCenters '0,0,0'
    

Regarding the 3dttest++ script, could you provide the contents of the bmi_nic_6thsep.txt file?

Gang Chen

I corrected but no result:

3dMVM -prefix Output_3dMVM -jobs 3
-bsVars 'BMI+NIC+inter'
-qVars 'BMI,NIC,inter'
-qVarCenters '0,0,0'
-mask BrainMask_MNI_222.nii
-num_glt 3
-gltLabel 1 'BMI_main' -gltCode 1 'BMI :'
-gltLabel 2 'NIC_main' -gltCode 2 'NIC :'
-gltLabel 3 'BMI_NIC_interaction' -gltCode 3 'inter :'
-dataTable
Subj BMI NIC inter InputFile
S0229 -0.06 -1.79 0.12 S0229_r1_larc_Z+orig
S0230 9.62 5.21 50.06 S0230_r1_larc_Z+orig
S0232 3.6 -1.79 -6.45 S0232_r1_larc_Z+orig
S0237 -5.9 1.21 -7.12 S0237_r1_larc_Z+orig
S0266 -4.93 -1.79 8.85 S0266_r1_larc_Z+orig
S0277 -5.96 -1.79 10.7 S0277_r1_larc_Z+orig
S0288 2.35 4.21 9.86 S0288_r1_larc_Z+orig
S0298 -4.49 -1.79 8.06 S0298_r1_larc_Z+orig
S0351 -6.9 3.21 -22.14 S0351_r1_larc_Z+orig
S0382 -3.3 -1.79 5.93 S0382_r1_larc_Z+orig
S0523 3.5 5.21 18.2 S0523_r1_larc_Z+orig \

direction of influence: is NIC → BMI