3dLMEr Slow

AFNI version info (afni -ver): 23.0.7

Hello,

I'm a new user of 3dLMEr and I'm trying to run a linear mixed effects model to look at the effect of run*group on connectivity maps that I have.

My groups are learning versus learned, so I have for each participant runs labeled 1-12 for the learning session and the learned session (there are some subjects missing 1 run but it's rare).

I've seemed to get 3dLMEr working, but it's taken almost a full 12 hours to do half of what appears to be one run for one subject if I'm reading the log file correctly. I feel like I must be doing something wrong here and wanted to share incase it's obvious and I'm missing it.

Code below:

# Run 3dLMEr with debugging and detailed logging
3dLMEr \
    -prefix "$OUTPUT_PREFIX" \
    -jobs 4 \
    -model "Group*Run+(1|Subj)" \
    -qVars "Run" \
    -gltCode 1 'Group : 1*learning -1*learned Run : 1' \
    -gltCode 2 'Group : 1*learning -1*learned Run : 2' \
    -gltCode 3 'Group : 1*learning -1*learned Run : 3' \
    -gltCode 4 'Group : 1*learning -1*learned Run : 4' \
    -gltCode 5 'Group : 1*learning -1*learned Run : 5' \
    -gltCode 6 'Group : 1*learning -1*learned Run : 6' \
    -gltCode 7 'Group : 1*learning -1*learned Run : 7' \
    -gltCode 8 'Group : 1*learning -1*learned Run : 8' \
    -gltCode 9 'Group : 1*learning -1*learned Run : 9' \
    -gltCode 10 'Group : 1*learning -1*learned Run : 10' \
    -gltCode 11 'Group : 1*learning -1*learned Run : 11' \
    -gltCode 12 'Group : 1*learning -1*learned Run : 12' \
    -dataTable @$INPUT_TABLE > "$LOG_FILE" 2>&1

# Check if the command was successful
if [ $? -eq 0 ]; then
    echo "3dLMEr completed successfully for ROI $ROI. Output saved to $OUTPUT_PREFIX."
else
    echo "Error running 3dLMEr for ROI $ROI. Check log: $LOG_FILE"
fi

done

Thanks so much in advance,
Kylie

Kylie,

Could you clarify the following points regarding the analysis?

  • Is Group considered a between-individual factor while Run is a within-individual variable?

  • In the 3dLMEr script, the variable Run is treated as quantitative. Are you assuming a linear trend across runs? Aside from group comparisons at each run, what other effects are the primary focus?

  • How many individuals are included in the data analysis? What is the voxel size?

Gang Chen

Hi Gang,

Thanks for the quick response. Before answering I realized this morning that maybe it's accurately performing at the population level and it's just taking a long time because of the amount of data. I might have misunderstood the output log because it starts with a message about converting NIFTI to float but only for subject 1, run 1.

  1. Group and run are both within-individual variables. Each participant is learning the task across runs and brought back on day 2 once it's learned.

  2. Because they learn the task run-by-run, I assumed run should be quantitative. The only effect I'm focusing on is the group comparison (learning versus learned) at each run. I'd like to isolate the difference between hippocampal connectivity while participants are learning the task and look at this effect as it changes run-by-run. Since I have the day 2 data, it seemed the best way to assess this.

  3. There are 21 participants and the voxel size is 2mm isotropic.

Thank you kindly!
Kylie

Kylie,

The assumption of linearity across runs might be overly restrictive. I recommend treating Run as a categorical factor instead. To implement this, you could modify the model specification from:

-model "Group*Run+(1|Subj)" \  

to:

-model "Group*Run+(1|Subj)+(1|Subj:Group)+(1|Subj:Run)" \  

For additional guidance on model specification in 3dLMEr, you may find this blog post helpful.

If you treat Run as a categorical variable, the lines specifying those post hoc tests via -gltCode will need to be adjusted accordingly.

Gang Chen

Thank you so much, I'll try this.

Kylie