Does 3dLMEr -vVar option accept surface (.niml.dset)?

Hi there,
I had a problem running 3dLMEr on surface files. My goal is to investigate the effect of baseline surface. So I put covariate BL as vVar, but I don't know if surface vVars are accepted. Alternatively I could convert all surface to volume to do this, but I am just wondering if surface vVar is possible.
Here is my code:

-model 'TREAT*BL+AGE+TREAT*VIS_ORDER+(1+VIS_ORDER|Subj)'   \
         -vVars 'BL' \  # volume vars: BL (each subject has only 1 baseline surface, is surface vVar causing errors?)
         -qVars 'AGE,VIS_ORDER' \ # quantitative variables: age and visit order
         -gltCode PLA.BL        'TREAT : 1*PLA BL : ' \ # effect size of BL in PLA group
         -gltCode DRUG_PLA.BL     'TREAT : 1*PLA -1*DRUG BL : ' \ # compare effect size of BL
         -gltCode DRUG_PLA.VIS_ORDER       'TREAT : 1*PLA -1*DRUG VIS_ORDER : ' \ # compare effect size of visit order
	     -dataTable @delta_cort_thick_bl_lh.txt

Here is the error. I have successfully run the similar test using similar code on volume data so my diagnosis for error culprit is vVars.

~~~~~~~~~~~~~~~~~~~ Model test failed  ~~~~~~~~~~~~~~~~~~~
Possible reasons:

0) Missing R packages lme4, lmerTest, and phia. 
1) Inappropriate model specification with options -model, or -qVars.

2) Incorrect specifications with -gltCode.

3) inconsistencies in the data table.
4) Inconsistent variable names (e.g., typos, case sensitive characters).

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

To better evaluate the statistical framework, could you clarify the following aspects of the experimental design:

  • Data acquisition: Please provide some background information about the scanning protocol for each participant.
  • Model structure: What is the nature of the variables included in the group-level model (i.e., which are treated as within-individual vs. between-individual factors)?
  • Covariate rationale: What is the specific justification for including variables such as visit order and age in the final model?

Gang Chen

Thanks Gang for replying!
My data are surfaces (.niml.dset files) generated from processing MP-RAGE sequence T1 images. All surfaces are std.20 mesh with cortical thickness values at each vertex.
I am trying to model the effect of baseline cortical thickness (z-score against a normative set) on the change of cortical thickness in follow-up visits relative to baseline (∆Thickness). Input variables are:

AGE: numerical, age at baseline visit
TREAT: group-level factor (DRUG and PLA)
BL: Baseline thickness z score, surfaces, each individual has 1
VIS_ORDER: numerical, each individual has precisely 2 visits, so VIS_ORDER have value 1, 2 

The only within-individual variable is the visiting order (follow-up 1 and follow-up 2). Between-individual factors are AGE, BL. I want to compare the effect of BL between DRUG and PLA, so I had a TREAT*BL term. VIS_ORDER marks the year after the beginning of the treatment. AGE is the age at baseline visit (visit 0), used as a demographic variable.

Updates since last post: running same 3dLMEr model on surface converted volumes also gave me the same error. However, if I remove VIS_ORDER from random factor: (1+VIS_ORDER|Subj) -> (1|Subj), the 3dLMEr ran successfully ran on volumes, but surfaces still threw an error message:

[1] "Great, test run passed at voxel (1, 1, 1)!"
[1] "Start to compute 1 slices along Z axis. You can monitor the progress"
[1] "and estimate the total run time as shown below."
[1] "03/10/26 10:49:33.788"
Error in rbind(inData, array(0, dim = c(fill, nF))) : 
  number of columns of matrices must match (see arg 2)
Execution halted

Thanks in advance for your guidance!

Based on your current setting, the model should be specified as follows:

-model 'TREAT*BL+AGE+TREAT*VIS_ORDER+(1|Subj)'

For a more detailed breakdown of model specification and syntax within 3dLMEr, I recommend checking out this blog post.

Gang Chen

Hi Gang,
This model specification indeed ran successfully on volume data (see update in previous reply). However, running it on surface still gave the error message (see below). Is this because of -vVars being set as surface? removing vVar entirely did run through successfully on surface.

[1] "Great, test run passed at voxel (1, 1, 1)!"
[1] "Start to compute 1 slices along Z axis. You can monitor the progress"
[1] "and estimate the total run time as shown below."
[1] "03/10/26 10:49:33.788"
Error in rbind(inData, array(0, dim = c(fill, nF))) : 
  number of columns of matrices must match (see arg 2)
Execution halted

I will take a close look at the situation and see if I could fix the issue without requesting for your data and script.

Gang CHen

1 Like

Thanks a lot Gang! After some digging in, I found the bug is line#1291 of 3dLMEr.R, where the padding dimension did not consider the concatenated vVar. I added nF <- dim(inData)[2] to update the dimension and the program successfully ran through. Please verify if that is the correct fix whenever it is convenient for you!

Thanks for sharing your finding and the fix! That line is indeed problematic for surface data. Does the new result match the volumetric one?

Gang Chen

Hi Gang, the results are consistent with the volume outputs.
Some minor problems with the output:
The output 1D file doesn't have the correct subbrick labels or p values or FDR associated with stat bricks.
The output is a .1D file which needs to be converted to dset using ConvertDset in order to visualize in suma. Would be nice if the program outputs a dset file directly readable by suma.