3dMVM error and question

AFNI version info (afni -ver): 24.1.19
Hi guys,
Sorry to keep asking for help with 3dMVM (it's the perfect program to humble me regularly).
For this particular script i have mice that have been categorized as either 1) low, 2) medium or, 3) high vulnerability and this vulnerability variable is the variable of interest. We would like to control for age and sex. age is a quantitative variable and i pre-centered the 'age' variable within each of the 3 groups but the ages were either '6' or '7' so the variability was almost nothing.

Im running the following 3dMVM script:

3dMVM -prefix ${RESDIR}/${SEEDVAR}_MVMdiscrete_results.nii.gz -jobs 24 -mask ${MASK} \
  -bsVars "vulnerability*sex*age" \
  -qVars "age" \
  -SS_type 2 \
  -num_glt 9 \
  -gltLabel 1 LowvsMed -gltCode 1 'vulnerability : 1*low -1*medium' \
  -gltLabel 2 LowvsHigh -gltCode 2 'vulnerability : 1*low -1*high' \
  -gltLabel 3 MedvsHigh -gltCode 3 'vulnerability : 1*medium -1 high' \
  -gltLabel 4 Low -gltCode 4 'vulnerability : 1*low' \
  -gltLabel 5 Med -gltCode 5 'vulnerability : 1*medium' \
  -gltLabel 6 High -gltCode 6 'vulnerability : 1*high' \
  -gltLabel 7 LowMed_by_sex -gltCode 7 'vulnerability : 1*low -1*medium sex : 1*male -1*female' \
  -gltLabel 8 LowHigh_by_sex -gltCode 8 'vulnerability : 1*low -1*high sex : 1*male -1*female' \
  -gltLabel 9 MedHigh_by_sex -gltCode 9 'vulnerability : 1*medium -1*high sex : 1*male -1*female' \
  -dataTable @/Dedicated/inc_database/scripts/rhultman/VEFxfMRI/VEFxfMRI_MVMdiscrete_datatable_infralimbicarea2.txt

And getting the following error:

AFNI REGISTRATION VERSION:
Precompiled binary linux_openmp_64: Jun 17 2024 (Version AFNI_24.1.19 'Publius Septimius Geta')

Checking dataTable file:
VEFxfMRI_MVMdiscrete_datatable_infralimbicarea2.txt

++Good: Table is regular and rectangular.
Read 101 items

Dimensions:
rows: 16 | columns: 5

Data summary:
Variable Detected_Type Details
Subj Subjects Num Subjects=16
age Quantitative Min=-0.75 | Max=0.625
sex Categorical Counts: female=5 | male=11
vulnerability Categorical Counts: high=8 | low=4 | medium=4
InputFile Data Number of InputFiles=16

++ Good: All InputFiles exist.

++ Good: All InputFiles have exactly 1 volume.

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

+* Warning: Log file: /Shared/Hultman_Lab/Neuroimaging/VEFxfMRI/derivatives/func/seedFC_AllenMouse/seed2wholebrain/groupAnalyses/3dMVM/infralimbic_area_MVMdiscrete_results_log.txt exists! NOT OVERWRITING!!

Loading required package: lme4
Loading required package: Matrix
Registered S3 methods overwritten by 'car':
method from
influence.merMod lme4
cooks.distance.influence.merMod lme4
dfbeta.influence.merMod lme4
dfbetas.influence.merMod lme4


Welcome to afex. For support visit: http://afex.singmann.science/

  • Functions for ANOVAs: aov_car(), aov_ez(), and aov_4()
  • Methods for calculating p-values with mixed(): 'S', 'KR', 'LRT', and 'PB'
  • 'afex_aov' and 'mixed' objects can be passed to emmeans() for follow-up tests
  • Get and set global package options with: afex_options()
  • Set sum-to-zero contrasts globally: set_sum_contrasts()
  • For example analyses see: browseVignettes("afex")

Attaching package: ‘afex’

The following object is masked from ‘package:lme4’:

lmer

Warning messages:
1: replacing previous import ‘ellipsis::check_dots_unnamed’ by ‘rlang::check_dots_unnamed’ when loading ‘hms’
2: replacing previous import ‘ellipsis::check_dots_used’ by ‘rlang::check_dots_used’ when loading ‘hms’
3: replacing previous import ‘ellipsis::check_dots_empty’ by ‘rlang::check_dots_empty’ when loading ‘hms’
4: replacing previous import ‘ellipsis::check_dots_unnamed’ by ‘rlang::check_dots_unnamed’ when loading ‘tibble’
5: replacing previous import ‘ellipsis::check_dots_used’ by ‘rlang::check_dots_used’ when loading ‘tibble’
6: replacing previous import ‘ellipsis::check_dots_empty’ by ‘rlang::check_dots_empty’ when loading ‘tibble’
7: replacing previous import ‘ellipsis::check_dots_unnamed’ by ‘rlang::check_dots_unnamed’ when loading ‘pillar’
8: replacing previous import ‘ellipsis::check_dots_used’ by ‘rlang::check_dots_used’ when loading ‘pillar’
9: replacing previous import ‘ellipsis::check_dots_empty’ by ‘rlang::check_dots_empty’ when loading ‘pillar’
Loading required package: car
Loading required package: carData

++++++++++++++++++++++++++++++++++++++++++++++++++++
***** Summary information of data structure *****
16 subjects : VEF01 VEF02 VEF03 VEF07 VEF08 VEF09 VEF10 VEF11 VEF12 VEF13 VEF14 VEF15 VEF16 VEF17 VEF18 VEF19
16 response values
16 centered values for numeric variable age : -0.358125 -0.751125 -0.376125 -0.376125 -0.376125 -0.376125 0.623875 -0.001125 0.248875 0.248875 0.248875 0.623875 -0.001125 0.623875 -0.001125 -0.001125
2 levels for factor sex : female male
3 levels for factor vulnerability : high low medium
9 post hoc tests

Contingency tables of subject distributions among the categorical variables:

         sex

vulnerability female male
high 2 6
low 3 1
medium 0 4

Tabulation of subjects against each of the categorical variables:

lop$nSubj vs sex:
       
        female male
  VEF01      0    1
  VEF02      0    1
  VEF03      0    1
  VEF07      0    1
  VEF08      0    1
  VEF09      0    1
  VEF10      0    1
  VEF11      0    1
  VEF12      0    1
  VEF13      0    1
  VEF14      0    1
  VEF15      1    0
  VEF16      1    0
  VEF17      1    0
  VEF18      1    0
  VEF19      1    0

lop$nSubj vs vulnerability:

    high low medium

VEF01 1 0 0
VEF02 0 0 1
VEF03 1 0 0
VEF07 1 0 0
VEF08 1 0 0
VEF09 1 0 0
VEF10 1 0 0
VEF11 0 1 0
VEF12 0 0 1
VEF13 0 0 1
VEF14 0 0 1
VEF15 1 0 0
VEF16 0 1 0
VEF17 1 0 0
VEF18 0 1 0
VEF19 0 1 0

***** End of data structure information *****
++++++++++++++++++++++++++++++++++++++++++++++++++++

Reading input files now...

Reading input files: Done!

Range of input data: [-1.543, 3.074]

If the program hangs here for more than, for example, half an hour,
kill the process because the model specification or the GLT coding
is likely inappropriate.

Possible reasons:

0) Make sure that R packages afex and phia have been installed. See the 3dMVM
help documentation for more details.

1) Inappropriate model specification with options -bsVars, -wsVars, or -qVars.
Note that within-subject or repeated-measures variables have to be declared
with -wsVars.

2) Incorrect specifications in general linear test coding with -gltCode.

3) Mistakes in data table. Check the data structure shown above, and verify
whether there are any inconsistencies.

4) Inconsistent variable names which are case sensitive. For example, factor
named Group in model specification and then listed as group in the table header
would cause grief for 3dMVM.

5) Not enough number of subjects. This may happen when there are two or more
within-subject factors. For example, a model with two within-subject factors with
m and n levels respectively requires more than (m-1)*(n-1) subjects to be able to
model the two-way interaction with the multivariate approach.


** Error: 
   Quitting due to model test failure...

The data table looks like this:

Subj	age	sex	vulnerability	InputFile	\
VEF01	-.357	male	high	${FILE01} \
VEF02	-.75	male	medium ${FILE02} \
VEF03	-.375	male	high	${FILE03} \
VEF07	-.375	male	high	${FILE07} \
VEF08	-.375	male	high	${FILE08} \
VEF09	-.375	male	high	${FILE09} \
VEF10 	.625	male	high	${FILE10} \
VEF11	0	male	low	${FILE11} \
VEF12	.25	male	medium	${FILE12} \
VEF13	.25	male	medium	${FILE13} \
VEF14	.25	male	medium	${FILE14} \
VEF15	.625	female	high	${FILE15} \
VEF16	0	female	low	${FILE16} \
VEF17	.625	female	high	${FILE17} \
VEF18	0	female	low	${FILE18} \
VEF19	0	female	low	${FILE19}

The only thing I can think of is there being an issue with there being no females in the medium vulnerability group. This is also the first time I am writing the glts for 7-9 so those might be off too. Do you guys see anything off here?

That was the error now this is the question. The above 3dMVM script had the mice categorized as either low, medium, or high vulnerability. This is kinda my proof of concept script but what i ACTUALLy want to do is, instead of a categorical variable vulnerability as the IV, I would like to use a continuous variable EOF as the IV instead (replacing vulnerability entirely) while keeping everything else the same. I figure I just replace vulnerability with EOF in the datatable and replace vulnerability with EOF in the bsVars section. I also believe EOF should be added to qVars.
My main questions are basically:

  1. Should i center EOF within the groups? Should I center EOF at all?
  2. Do the gltCodes need to change?
  3. Am I missing anything else obvious?

Thanks as always guys. Hoping for a future i can run all MVM scripts without errors.
lauren

Lauren,

Given the grouping structure you provided:

vulnerability  female  male
high               2      6
low                3      1
medium             0      4

you wouldn't be able to properly assess the interaction between vulnerability and sex with sparse or empty cells. With only one or no participants in some cells, it's understandable that 3dMVM was unable to pass the model check.

  • Whether to center EOF depends on two main factors:

    1. Your effect of interest: What effects are you focusing on?
    2. Mean differences across sexes: Do males and females differ in their average EOF? If so, centering might help clarify the interpretation of sex effects.
  • When switching from a categorical vulnerability variable to a continuous measure like EOF, some adjustments are also needed in the -gltCode specifications. This is essential to ensure that the comparisons you’re testing remain valid within the new variable context.

  • Do you want to model the interaction between EOF and age? Such interaction may require specific treatment.

Gang Chen

Thanks for the clarification on the interaction, @Gang, that's kind of what I thought.
With EOF,
The inputs here are whole brain maps. The value at each voxel is the z-scored r-value for that voxel and a given seed's timeseries (e.g. infralimbic cortex seed)

  1. The idea is to see if higher EOF values are associated with higher (or lower) z-scores.
  2. There is in fact a difference across sexes (m=.06, f=.04)
  3. I don't think modeling the EOF and age interaction is necessary in this specific case because there is essentially no variability in age here (although I will probably come asking about this in the future when we get a wider variety of aged animals).

Thanks Gang!

lauren

Lauren,

If you're interested in comparing the sex difference of the EOF association with the voxel-level z-score, it’s crucial to clarify whether the sex difference in EOF is causal. If sex is a causal factor for differences in EOF, then EOF would serve as a mediator. In that case, centering EOF within each sex group is appropriate. If causality is not assumed (i.e., the observed sex difference in EOF is due to sampling), consider cross-sex centering for EOF. For a deeper dive into this subtlety, refer to this blog post.

For your model specification, you might try:

3dMVM ... \
  -bsVars "EOF*sex+age" \
  -qVars "EOF,age" \
  ...

Gang Chen

Hey @Gang,
So far so good. One final question for now. In the case where I'm assuming sex is not a causal factor in EOF differences, is cross-sex centering the same as centering all EOF values around the mean (for example)?

thanks Gang, youre the best.
lauren

Lauren,

Yes, cross-sex centering involves subtracting a constant from the EOF values. This constant is typically chosen for interpretability and can be the overall participant average, a reference value from the literature, or another meaningful benchmark. By default, 3dMVM automatically performs mean-centering across all participants. If you decide to choose a center other than overall mean, use the option -qVarCenter.

Gang Chen

Perfect @Gang i think that's all I wanted to check. Appreciate your help as always!