Including a voxelwise covariate in 3dLME

AFNI version info (afni -ver): 23.3.09

I'm having trouble including a voxelwise covariate in my 3dLME model using -vVars. The way I've implemented it is by adding a column called baseline to my data table and then calling that using -vVars baseline, as below (I've simplified the GLT compared to what I actually want to run whilst I'm debugging)

3dLME -prefix group-model 	\
-resid group-model-resid 	\
-model 'group+treatment+ambiguity*valence' 	\
-vVars 'baseline' 	\
-ranEff '~1' 	\
-num_glt 1 	\
-mask grey-matter-mask+tlrc 	\
-gltLabel 1 control-vs-patient -gltCode 1 'group: 1*control -1*patient' 	\
-dataTable @data-table.txt

my data table looks as follows:

Subj group treatment ambiguity valence baseline InputFile \
sub-004 control placebo ambiguous high sub-004_ses-1_onset-activation_stats+tlrc[onset_ambiguous-high#0_Coef] sub-004_ses-2_onset-activation_stats+tlrc[onset_ambiguous-high#0_Coef] \
sub-004 control placebo ambiguous low sub-004_ses-1_onset-activation_stats+tlrc[onset_ambiguous-low#0_Coef] sub-004_ses-2_onset-activation_stats+tlrc[onset_ambiguous-low#0_Coef] \
sub-004 control placebo unambiguous high sub-004_ses-1_onset-activation_stats+tlrc[onset_unambiguous-high#0_Coef] sub-004_ses-2_onset-activation_stats+tlrc[onset_unambiguous-high#0_Coef] \
sub-004 control placebo unambiguous low sub-004_ses-1_onset-activation_stats+tlrc[onset_unambiguous-low#0_Coef] sub-004_ses-2_onset-activation_stats+tlrc[onset_unambiguous-low#0_Coef] \
sub-006 control placebo ambiguous high sub-006_ses-1_onset-activation_stats+tlrc[onset_ambiguous-high#0_Coef] sub-006_ses-2_onset-activation_stats+tlrc[onset_ambiguous-high#0_Coef] \
...

When I run the script, it seems to work but then halts with the following error:

Reading input files now...

Reading input files: Done!


Range of input data: [-39.789, 23.971]

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.

[1] "Great, test run passed at voxel (70, 85, 43)!"
[1] "Start to compute 97 slices along Z axis. You can monitor the progress"
[1] "and estimate the total run time as shown below."
[1] "01/12/24 16:09:14.227"
Loading required package: snow
Package snow loaded successfully!

Error in Stat[, , kk, ] <- aperm(parApply(cl, inData[, , kk, ], c(1, 2),  : 
  number of items to replace is not a multiple of replacement length
Execution halted

I'm not sure where to start with fixing that error- when I run the script without -vVars it does work so that seems to be the problem.

Thanks in advance!

There are a couple of issues with the model specification:

  1. The baseline variable is not included in the model formula using -model.

  2. It's unclear whether ambiguity, valence, and baseline vary within individuals. If they do, the model might not have been specified correctly. For more information and guidance on specifying individual-level random effects in hierarchical modeling, you may find this blog post helpful.

If you have any questions or need further clarification, feel free to reach out.

Gang Chen