Large values in 3dLMEr

[picchionid@cn4292 test_10.02.07_no_cond_in_model]$ afni -ver
Precompiled binary linux_rocky_8: Sep 18 2024 (Version AFNI_24.2.07 'Macrinus')
[picchionid@cn4292 test_10.02.07_no_cond_in_model]$ R --version
R version 4.4.1 (2024-06-14) -- "Race for Your Life"

Gang!

Hi! How are you? The revisions to our sleep manuscript are going well. I have a question for you.

I ran a 3dLMEr command successfully. Great results. Perfect. Replicates prior work. Already robust against many exploratory tweaks of the analysis. It used the quantitative factor of auditory arousal threshold (AAT). This quantitative factor comes from a sound pressure level meter where the firmware automatically performs a log() transformation because that is very standard. The team and I wanted to check whether the results are further robust against using the nontransformed values, so I repeated the command with a 10^AAT transformation. When I did so, 3dLMEr gave me "Error: Quitting due to model test failure." Why might that happen? See below for the successful version of the code and the output from 3dLMEr from unsuccessful code.

Sincerely,

Dante

Excerpt from successful code:

3dLMEr \
    -prefix output_lme_audaro_hip_procbasic_rz_nocondinmodel.nii \
    -jobs 32 \
    -model "1+AAT+(1+AAT|Subj)" \
    -qVars 'AAT' \
    -R2 \
    -SS_type 3 \
    -gltCode AATeff 'AAT : ' \
    -dataTable \
    Subj	Noise	Cond	AAT	SStage	InputFile \
s00003  0.924046        aro1    70      n3      ../20160713_2255_hip_procbasic_rz.nii
s00003  0.593909        aro2    25      n2      ../20160713_2326_hip_procbasic_rz.nii
...
s00105  0.0916635       aro5    0       r       ../20170413_0535_hip_procbasic_rz.nii

Output from 3dLMEr from unsuccessful code:

Dimensions: 
rows: 77 | columns: 6

+* Warning: Each "Subj" does not have the same number of "InputFiles"!
Most Subj have 8 InputFiles. The following Subj differ:
 Subj   NumInputFiles
 s00003 5            
 s00014 6            
 s00047 5            
 s00056 7            
 s00060 4            
 s00063 6            
 s00086 7            
 s00105 5            

Data summary: 
 Variable  Detected_Type Details                            
 Subj      Subjects      Num Subjects=12                    
 Noise     Quantitative  Min=0.0155511 | Max=0.990234       
 Cond      Categorical   Unique levels=8                    
 AAT       Quantitative  Min=1 | Max=1e+70 | Num outliers=17
 SStage    Categorical   Unique levels=5                    
 InputFile Data          Number of InputFiles=77            

++ Good: All InputFiles exist.

++ Good: All InputFiles have exactly 1 volume.

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


++++++++++++++++++++++++++++++++++++++++++++++++++++
***** Summary information of data structure *****
77 response values
8 levels for factor Cond : aro1 aro2 aro3 aro4 aro5 aro6 aro7 aro8 
77 centered values for numeric variable AAT : 9.74026e+69 -2.597403e+68 -2.597403e+68 -2.597403e+68 9.74026e+69 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 -2.597403e+68 
5 levels for factor SStage : n1 n2 n3 r w 
***** End of data structure information *****
++++++++++++++++++++++++++++++++++++++++++++++++++++

Reading input files now...

Reading input files for effect estimates: 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 something else
is likely inappropriate.

Loading required package: lme4
Loading required package: Matrix
Package lme4 loaded successfully!

Loading required package: lmerTest

Attaching package: ‘lmerTest’

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

    lmer

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

    step

Package lmerTest loaded successfully!

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

Loading required package: MuMIn
Package MuMIn loaded successfully!

~~~~~~~~~~~~~~~~~~~ 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...

Dante,

One possibility is that the large values may have caused some calculations to exceed the precision limits of your computer. I suggest scaling the values of the variable AAT by, for example, 10^{69}, and then inputting them into the data table. In the output, you can make corresponding adjustment about the AAT parameter estimates. Let me know if this method would resolve the issue.

Gang Chen

1 Like

Thanks. Let me think about this.

Gang,

Hi again. Thanks again for your help.

I corresponded with Jonathan Goodson at Biowulf, where I ran the AFNI/R code. He gave me some good thoughts and said "this is a characteristic of the software and not the hardware that it is running on." He also said "Standard double-precision floating point values range to about +/- 2e308. ... At least for R, all real numbers are stored as double-precision floats by default, although interactions with other non-R code can complicate this." What do you think of this? It seems my Min=1 and Max=1e+70 numbers should work.

I do not understand your suggested workaround. That is what I did. I scaled the values with a 10^AAT transformation before inputting them into the data table.

Sincerely,

Dante

Howdy-

I'm chiming in here unasked, and perhaps unwanted, but I must admit doing calculations a range of [1, 10^70] here seems like possibly asking for trouble. It is true that such things can be done, but you might incur woe with algorithms that assume only standard floating point range; rounding error and precision loss could easily creep in. That is a huge range, and I would guess it is likely to create numerical stability issues.

--pt