3dLMEr - Using functional connectivity as a predictor

Hello AFNI folks,

I am looking to structure a group analysis using voxel-level data as a predictor rather than the response variable. More specifically, I want to fit an LMEr model at each voxel, where symptoms at a follow-up time point are being explained by an interaction between a ‘risk’ variable (between-subject) and functional connectivity at that voxel at baseline (also between subject, but each voxel/subject will have unique FC values). My approach is as follows:

  1. Create a new .nii file for each subject (with the same grid as FC maps) containing the symptom value to be predicted for each voxel - here, because the symptom score does not vary within-subject, the .nii file would contain the same symptom value for all voxels.

  2. Create a data table using the examples from 3dLME, with a ‘BRAIN_FC’ column containing the path to the FC map for that subject. The table would also include the between-subject ‘risk’ variable, other between-subject covariates, and the InputFile column contains the .nii file created in (1).

  3. Use the following command to test for an interaction between risk and FC at baseline to predict symptoms:

         3dLMEr -prefix ${out}/3dLMEr_${seed}_${hemi}_brainXrisk_combined.nii.gz -jobs 15 \
             -mask ${templates}/MNI152_T1_2.4mm_gm.nii.gz \
             -qVars "COV1,COV3" \
             -qVarCenters "0.0,0.0" \
             -gltCode risk_high-low 'RISK : 1*high -1*low' \
             -gltCode brain 'BRAIN_FC :' \
             -gltCode brainXrisk_high-low 'BRAIN_FC : RISK : 1*high -1*low' \
             -model 'RISK*BRAIN_FC+COV1+COV2+COV3+(1|COV4)' \
             -dataTable @${out}/LMEr_tables/${seed}_${hemi}_brainXrisk_combined.tsv
    

COV1, 2, and 3 are between-subject covariates (2 continuous, 1 categorical) and COV4 is a ‘site’ variable for which we want to model a random intercept.

When I attempt to run this model, I get the following error:
** Error:
Incorrect level coding in variable BRAIN_FC : :

I have also attempted to use the -vVars option with BRAIN_FC column as input and taken out the -gltCode for the BRAIN_FC main effect and continue to get this error. Any advice on my approach, a better way of modeling this question, or help troubleshooting this error would be greatly appreciated!

A couple of suggestions:

  1. You need to explicitly specify the model using the option -model
  2. Add “-vVars BRAIN_FC” to your 3dLMEr script

Thanks, Gang!

From the previous command I posted, I have the -model option as follows:
-model ‘RISK*BRAIN_FC+COV1+COV2+COV3+(1|COV4)’ \

I did try using vVars option and continue to get the ‘Incorrect level coding in variable BRAIN_FC : :’ error.
I’m assuming I am incorrectly specifying the main effect and/or interaction glt using BRAIN_FC, but it seems consistent with the examples online.

Thanks again!

Change

-qVars “COV1,COV3” \

to

-qVars “COV1,COV3,BRAIN_FC” \

Also check out this:

" -vVars variable_list: Identify voxel-wise covariates with this option.
Currently one voxel-wise covariate is allowed only. By default
mean centering is performed voxel-wise across all subjects.
Alternatively centering can be specified through a global value
under -vVarsCenters. If the voxel-wise covariates have already
been centered, set the centers at 0 with -vVarsCenters."

Thanks, Gang!

Unfortunately, when I try using the -qVars option with BRAIN_FC, the ‘Incorrect level coding in variable BRAIN_FC : :’ error still remains.

For convenience sake, I’ve listed out the alternatives I’ve tried thus far (below, all of which give me the same error). I’ve also attached an example data table (first 9 rows) in case I am formatting something incorrectly.

  1. Adding “-vVars 'BRAIN_FC”, both with and without “-vVarCenters”
  2. Adding “-qVars ‘COV1,COV3,BRAIN_FC’” and “-qVarCenters ‘0.0,0.0,0.0’”
  3. Removing “-gltCode brain ‘BRAIN_FC :’”
  4. Removing -gltCode brainXrisk ‘BRAIN_FC : RISK : 1high -1low’"

A quick update:

I’ve isolated the error to the -gltCode - everything runs smoothly when I have no gltCode containing BRAIN_FC.

With 3dLMEr, can variables specified with ‘-vVars’ be used inside a gltCode?

For example, this command works:
3dLMEr -prefix ${out}/3dLMEr_${seed}_${hemi}brainXrisk.nii.gz -jobs 15
-mask ${templates}/MNI152_T1_2.4mm_gm.nii.gz
-qVars “COV1,COV3”
-qVarCenters “0.0,0.0”
-vVars ‘BRAIN_FC’
-gltCode risk_high-low ‘RISK : 1high -1low’
-model ‘RISK*BRAIN_FC+COV1+COV2+COV3+(1|COV4)’
-dataTable @LMEr_tables/${seed}
${hemi}_brainXrisk.tsv

But this command does not (Incorrect variable coding error):
3dLMEr -prefix ${out}/3dLMEr_${seed}_${hemi}brainXrisk.nii.gz -jobs 15
-mask ${templates}/MNI152_T1_2.4mm_gm.nii.gz
-qVars “COV1,COV3”
-qVarCenters “0.0,0.0”
-vVars ‘BRAIN_FC’
[b]-gltCode brain ‘BRAIN_FC :’ [/b]
-gltCode risk_high-low ‘RISK : 1high -1low’
-model ‘RISK*BRAIN_FC+COV1+COV2+COV3+(1|COV4)’
-dataTable @LMEr_tables/${seed}
${hemi}_brainXrisk.tsv

In the most recent scripts you showed, it does not appear that you did the following:

Change

-qVars “COV1,COV3” \

to

-qVars “COV1,COV3,BRAIN_FC” \

Also, this line

-gltCode brainXrisk_high-low ‘BRAIN_FC : RISK : 1high -1low’ \

should be

-gltCode brainXrisk_high-low ‘RISK : 1high -1low BRAIN_FC :’ \

When I add BRAIN_FC to the -qVars (in addition to -vVars ‘BRAIN_FC’), I get the following error:

In process.LME.opts(lop, verb = lop$verb) : NAs introduced by coercion
Error in FUN(x, aperm(array(STATS, dims[perm]), order(perm)), …) :
non-numeric argument to binary operator
Calls: scale → scale.default → sweep
Execution halted

When I add BRAIN_FC to the -qVars (without -vVars ‘BRAIN_FC’), I don’t get an error, but NAs are introduced:
2194 centered values for numeric variable BRAIN_FC : NA NA NA NA NA NA NA NA NA…

The above errors only exist if I remove all -gltCode options that contain a ‘BRAIN_FC’ term. If I leave any of them in, the ‘Incorrect variable coding’ error is thrown immediately.

symptoms at a follow-up time point are being explained by an interaction between a ‘risk’ variable (between-subject) and functional connectivity
-model ‘RISK*BRAIN_FC+COV1+COV2+COV3+(1|COV4)’ \

Let’s backtrack a little bit. So, ‘RISK’ is a between-subject factor? There is no within-subject variable? And what is this part ‘(1|COV4)’ for?

Thanks Gang!

Yes, RISK is a between-subject factor (“high” vs. “low”) and the 1|COV4 term (COV4 = study site factor) is accounting for unique intercepts for each scanner. You are correct, there are no within-subject factors.