3dLME Example 3 model test failure


Hi. How are you? Would you please help me with a 3dLME problem?

I used 3dLME -help Example 3 as a template and am receiving "** Error: Quitting due to model test failure." For the design, the only difference with Example 3 is the second factor is also a within-subjects variable.

See below for the gory details. The code was run with R 4.3.0 and AFNI version=AFNI_23.3.01 (Oct 12 2023). Here are my troubleshooting steps. None revealed the problem.


file_tool -test -infiles slurm_h_multinode.sh


slurm_h_multinode.sh has 0 bad characters
slurm_h_multinode.sh file type: UNIX

I tried deleting the contrasts. No change.

Because the n1 and r levels of sstage both have only four data points across three subjects, I tried collapsing levels so that the remaining levels were only w_or_r, n1_or_n2, and n3. No change. Because I previously ran a very similar analysis successfully with cond, I did not try collapsing some of its levels.



+ 3dLME -prefix output_lme_sstage_hip_procbasic_rz.nii -jobs 8 -model 'cond*sstage' -ranEff '~1' -SS_type 3 -logLik -num_glt 4 -gltLabel 1 n1_v_w -gltCode 1 'sstage : 1*n1 -1*w' -gltLabel 2 n2_v_w -gltCode 2 'sstage : 1*n2 -1*w' -gltLabel 3 n3_v_w -gltCode 3 'sstage : 1*n3 -1*w' -gltLabel 4 r_v_w -gltCode 4 'sstage : 1*r -1*w' -dataTable Subj cond sstage InputFile s00003 aro1 n3 20160713_2255_hip_procbasic_rz.nii s00003 aro2 n2 20160713_2326_hip_procbasic_rz.nii s00003 aro3 n2 20160714_0004_hip_procbasic_rz.nii s00003 aro4 n2 20160714_0040_hip_procbasic_rz.nii s00003 aro5 n2 20160714_0220_hip_procbasic_rz.nii s00006 aro1 w 20160901_2245_hip_procbasic_rz.nii s00006 aro2 w 20160901_2300_hip_procbasic_rz.nii s00006 aro3 n2 20160901_2310_hip_procbasic_rz.nii s00006 aro4 n2 20160901_2340_hip_procbasic_rz.nii s00006 aro5 n2 20160901_2358_hip_procbasic_rz.nii s00006 aro6 w 20160902_0050_hip_procbasic_rz.nii s00006 aro7 n3 20160902_0140_hip_procbasic_rz.nii s00006 aro8 w 20160902_0625_hip_procbasic_rz.nii s00014 aro1 n2 20170118_2235_hip_procbasic_rz.nii s00014 aro2 w 20170119_0025_hip_procbasic_rz.nii s00014 aro3 n2 20170119_0055_hip_procbasic_rz.nii s00014 aro4 n2 20170119_0140_hip_procbasic_rz.nii s00014 aro5 w 20170119_0240_hip_procbasic_rz.nii s00014 aro6 w 20170119_0253_hip_procbasic_rz.nii s00029 aro1 w 20160518_2322_hip_procbasic_rz.nii s00029 aro2 n2 20160518_2336_hip_procbasic_rz.nii s00029 aro3 n3 20160519_0005_hip_procbasic_rz.nii s00029 aro4 n3 20160519_0035_hip_procbasic_rz.nii s00029 aro5 n2 20160519_0136_hip_procbasic_rz.nii s00029 aro6 w 20160519_0304_hip_procbasic_rz.nii s00029 aro7 w 20160519_0416_hip_procbasic_rz.nii s00029 aro8 n2 20160519_0431_hip_procbasic_rz.nii s00047 aro1 n3 20160630_0000_hip_procbasic_rz.nii s00047 aro2 n3 20160630_0031_hip_procbasic_rz.nii s00047 aro3 n2 20160630_0124_hip_procbasic_rz.nii s00047 aro4 r 20160630_0437_hip_procbasic_rz.nii s00047 aro5 n2 20160630_0600_hip_procbasic_rz.nii s00056 aro1 n1 20160921_2250_hip_procbasic_rz.nii s00056 aro2 n2 20160921_2305_hip_procbasic_rz.nii s00056 aro3 n2 20160921_2336_hip_procbasic_rz.nii s00056 aro4 n3 20160921_2345_hip_procbasic_rz.nii s00056 aro5 n3 20160922_0015_hip_procbasic_rz.nii s00056 aro6 n3 20160922_0035_hip_procbasic_rz.nii s00056 aro7 n1 20160922_0222_hip_procbasic_rz.nii s00060 aro1 w 20160804_0012_hip_procbasic_rz.nii s00060 aro2 n3 20160804_0110_hip_procbasic_rz.nii s00060 aro3 w 20160804_0225_hip_procbasic_rz.nii s00060 aro4 r 20160804_0322_hip_procbasic_rz.nii s00063 aro1 n2 20170222_2305_hip_procbasic_rz.nii s00063 aro2 n3 20170222_2323_hip_procbasic_rz.nii s00063 aro3 n2 20170222_2350_hip_procbasic_rz.nii s00063 aro4 n3 20170223_0155_hip_procbasic_rz.nii s00063 aro5 n3 20170223_0239_hip_procbasic_rz.nii s00063 aro6 n1 20170223_0434_hip_procbasic_rz.nii s00065 aro1 n3 20161027_2230_hip_procbasic_rz.nii s00065 aro2 n3 20161027_2330_hip_procbasic_rz.nii s00065 aro3 n3 20161028_0012_hip_procbasic_rz.nii s00065 aro4 n2 20161028_0053_hip_procbasic_rz.nii s00065 aro5 n2 20161028_0137_hip_procbasic_rz.nii s00065 aro6 n3 20161028_0313_hip_procbasic_rz.nii s00065 aro7 w 20161028_0406_hip_procbasic_rz.nii s00065 aro8 n2 20161028_0630_hip_procbasic_rz.nii s00078 aro1 n2 20170308_2255_hip_procbasic_rz.nii s00078 aro2 w 20170308_2336_hip_procbasic_rz.nii s00078 aro3 n3 20170308_2349_hip_procbasic_rz.nii s00078 aro4 n3 20170309_0027_hip_procbasic_rz.nii s00078 aro5 n2 20170309_0051_hip_procbasic_rz.nii s00078 aro6 n3 20170309_0153_hip_procbasic_rz.nii s00078 aro7 n2 20170309_0414_hip_procbasic_rz.nii s00078 aro8 n2 20170309_0525_hip_procbasic_rz.nii s00086 aro1 n2 20170208_2238_hip_procbasic_rz.nii s00086 aro2 n2 20170208_2305_hip_procbasic_rz.nii s00086 aro3 n2 20170208_2347_hip_procbasic_rz.nii s00086 aro4 n3 20170209_0000_hip_procbasic_rz.nii s00086 aro5 n2 20170209_0022_hip_procbasic_rz.nii s00086 aro6 n2 20170209_0309_hip_procbasic_rz.nii s00086 aro7 w 20170209_0405_hip_procbasic_rz.nii s00105 aro1 w 20170412_2304_hip_procbasic_rz.nii s00105 aro2 r 20170413_0112_hip_procbasic_rz.nii s00105 aro3 n2 20170413_0303_hip_procbasic_rz.nii s00105 aro4 n1 20170413_0406_hip_procbasic_rz.nii s00105 aro5 r 20170413_0535_hip_procbasic_rz.nii
[INFO] Please allocate lscratch for batch/sinteractive R jobs
Loading required package: nlme
Package nlme loaded successfully!

Loading required package: phia
Loading required package: car
Loading required package: carData
Package phia loaded successfully!

***** Summary information of data structure *****
12 subjects :  s00003 s00006 s00014 s00029 s00047 s00056 s00060 s00063 s00065 s00078 s00086 s00105 
77 response values
8 levels for factor cond : aro1 aro2 aro3 aro4 aro5 aro6 aro7 aro8 
5 levels for factor sstage : n1 n2 n3 r w 
4 post hoc tests

Contingency tables of subject distributions among the categorical variables:

Tabulation of subjects against all categorical variables
Subj vs cond:
         aro1 aro2 aro3 aro4 aro5 aro6 aro7 aro8
  s00003    1    1    1    1    1    0    0    0
  s00006    1    1    1    1    1    1    1    1
  s00014    1    1    1    1    1    1    0    0
  s00029    1    1    1    1    1    1    1    1
  s00047    1    1    1    1    1    0    0    0
  s00056    1    1    1    1    1    1    1    0
  s00060    1    1    1    1    0    0    0    0
  s00063    1    1    1    1    1    1    0    0
  s00065    1    1    1    1    1    1    1    1
  s00078    1    1    1    1    1    1    1    1
  s00086    1    1    1    1    1    1    1    0
  s00105    1    1    1    1    1    0    0    0

Subj vs sstage:
         n1 n2 n3 r w
  s00003  0  4  1 0 0
  s00006  0  3  1 0 4
  s00014  0  3  0 0 3
  s00029  0  3  2 0 3
  s00047  0  2  2 1 0
  s00056  2  2  3 0 0
  s00060  0  0  1 1 2
  s00063  1  2  3 0 0
  s00065  0  3  4 0 1
  s00078  0  4  3 0 1
  s00086  0  5  1 0 1
  s00105  1  1  0 2 1
***** End of data structure information *****

Reading input files now...

Reading input files: Done!

Range of input data: [-1.406, 1.716]

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.

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

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

1) Inappropriate model specification with options -model, or -qVars.

2) In correct 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 hader
would cause grief for 3dLME.

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


For the design, the only difference with Example 3 is the second factor is also a within-subjects variable.

In your case, you should have 480 input files when there's no missing data if both sstage and cond are within-individual factors. Therefore, the extent of missing data is 1 - 77/480 \approx 84\%. I suspect that this high level of missing data might be the primary reason for the model's failure. OTOH, sstage seems to be a between-individual (instead of within-individual) factor?

As a side note, I recommend considering an improved modeling approach. You might want to explore using 3dLMEr as discussed in this blog post. 3dLME will eventually be phased out.


1 Like


Hi again. Thanks!

The sstage variable is within-individual factor. Multiple subjects definitely "receive" the same levels of it. I put receive in quotes because it is a quasi-experimental design where sstage is not a randomly-assigned variable.

I ran a similar analysis without sstage but with a quantitative variable in its place. This resulted in only 20% missing data, the program ran without any problems, and the results replicated prior work. Therefore, I concur with your suspicion. For the sstage analysis, I will switch from 3dLME to 3dMVM, use listwise deletion, and run a two-way fully-repeated ANOVA.