3dLME with covariate issue

Dear AFNI experts,

I’m having some issues with my 3dLME command and would be grateful for some guidance. The design has:
1 between-subject factor “Group” with two levels: “control”, “patient”
1 within-subject factor “Category” with two levels: “shape”, “iaps”
1 within-subject covariate “Corr”

When I run file_tool on the script I get 0 bad characters.
When I run the script I get the following output:

During startup - Warning message:
Setting LC_CTYPE failed, using “C”
Read 515 items
Error in if (len%%wd != 0) errex.AFNI(paste(“The content under -dataTable is not rectangular !”, :
argument is of length zero
Calls: process.LME.opts
Execution halted

This is the script:

3dLME -prefix LME_results -jobs 1
-model “GroupCategoryCorr”
-qVars “Corr”
-ranEff ‘~1’
-SS_type 3
-num_glt 4
-gltLabel 1 ‘Group’ -gltCode 1 ‘Group: 1control -1patient’
-gltLabel 2 ‘iaps_vs_shape’ -gltCode 2 ‘Category: 1iaps -1shape’
-gltLabel 3 ‘GroupXCategory’ -gltCode 3 ‘Group: 1control -1patient Category: 1iaps -1shape’
-gltLabel 4 ‘GroupXiapsXCorr’ -gltCode 4 ‘Group: 1control -1patient Category: 1*iaps Corr :’
-dataTable @do_LME_table.txt
-mask singlesub/GM_resample+tlrc

And the associated table:

Subj Group Category Corr Inputfile
s02 control shape 0.66 singlesub/C_sub02.results/stats.C_sub02+tlrc[shape#0_Coef]
s03 control shape 0.16 singlesub/C_sub03.results/stats.C_sub03+tlrc[shape#0_Coef]
s05 control shape 0.34 singlesub/C_sub05.results/stats.C_sub05+tlrc[shape#0_Coef]
s06 control shape 0.94 singlesub/C_sub06.results/stats.C_sub06+tlrc[shape#0_Coef]
s07 control shape 0.28 singlesub/C_sub07.results/stats.C_sub07+tlrc[shape#0_Coef]
s08 control shape 0.46 singlesub/C_sub08.results/stats.C_sub08+tlrc[shape#0_Coef]
s09 control shape 1.86 singlesub/C_sub09.results/stats.C_sub09+tlrc[shape#0_Coef]
s11 control shape 1.05 singlesub/C_sub11.results/stats.C_sub11+tlrc[shape#0_Coef]
s12 control shape 1.28 singlesub/C_sub12.results/stats.C_sub12+tlrc[shape#0_Coef]
s13 control shape 0.08 singlesub/C_sub13.results/stats.C_sub13+tlrc[shape#0_Coef]
s14 control shape 0.51 singlesub/C_sub14.results/stats.C_sub14+tlrc[shape#0_Coef]
s15 control shape 0.24 singlesub/C_sub15.results/stats.C_sub15+tlrc[shape#0_Coef]
s17 control shape 0.83 singlesub/C_sub17.results/stats.C_sub17+tlrc[shape#0_Coef]
s18 control shape 0.18 singlesub/C_sub18.results/stats.C_sub18+tlrc[shape#0_Coef]
s19 control shape -0.50 singlesub/C_sub19.results/stats.C_sub19+tlrc[shape#0_Coef]
s20 control shape 0.12 singlesub/C_sub20.results/stats.C_sub20+tlrc[shape#0_Coef]
s21 control shape -0.09 singlesub/C_sub21.results/stats.C_sub21+tlrc[shape#0_Coef]
s22 control shape 0.44 singlesub/C_sub22.results/stats.C_sub22+tlrc[shape#0_Coef]
s23 control shape 0.11 singlesub/C_sub23.results/stats.C_sub23+tlrc[shape#0_Coef]
s24 control shape -0.08 singlesub/C_sub24.results/stats.C_sub24+tlrc[shape#0_Coef]
s26 control shape 0.34 singlesub/C_sub26.results/stats.C_sub26+tlrc[shape#0_Coef]
s27 control shape 0.24 singlesub/C_sub27.results/stats.C_sub27+tlrc[shape#0_Coef]
s28 control shape 0.81 singlesub/C_sub28.results/stats.C_sub28+tlrc[shape#0_Coef]
s29 control shape 1.08 singlesub/C_sub29.results/stats.C_sub29+tlrc[shape#0_Coef]
p01 patient shape 0.03 singlesub/P_sub01.results/stats.P_sub01+tlrc[shape#0_Coef]
p02 patient shape -0.26 singlesub/P_sub02.results/stats.P_sub02+tlrc[shape#0_Coef]
p03 patient shape 1.39 singlesub/P_sub03.results/stats.P_sub03+tlrc[shape#0_Coef]
p04 patient shape 1.58 singlesub/P_sub04.results/stats.P_sub04+tlrc[shape#0_Coef]
p05 patient shape 0.88 singlesub/P_sub05.results/stats.P_sub05+tlrc[shape#0_Coef]
p06 patient shape 0.53 singlesub/P_sub06.results/stats.P_sub06+tlrc[shape#0_Coef]
p07 patient shape 0.43 singlesub/P_sub07.results/stats.P_sub07+tlrc[shape#0_Coef]
p08 patient shape 2.27 singlesub/P_sub08.results/stats.P_sub08+tlrc[shape#0_Coef]
p09 patient shape 1.57 singlesub/P_sub09.results/stats.P_sub09+tlrc[shape#0_Coef]
p10 patient shape 0.22 singlesub/P_sub10.results/stats.P_sub10+tlrc[shape#0_Coef]
p11 patient shape -0.18 singlesub/P_sub11.results/stats.P_sub11+tlrc[shape#0_Coef]
p12 patient shape 0.09 singlesub/P_sub12.results/stats.P_sub12+tlrc[shape#0_Coef]
p13 patient shape 0.00 singlesub/P_sub13.results/stats.P_sub13+tlrc[shape#0_Coef]
p14 patient shape 0.38 singlesub/P_sub14.results/stats.P_sub14+tlrc[shape#0_Coef]
p15 patient shape 0.42 singlesub/P_sub15.results/stats.P_sub15+tlrc[shape#0_Coef]
p16 patient shape 1.65 singlesub/P_sub16.results/stats.P_sub16+tlrc[shape#0_Coef]
p17 patient shape 0.36 singlesub/P_sub17.results/stats.P_sub17+tlrc[shape#0_Coef]
p18 patient shape 0.13 singlesub/P_sub18.results/stats.P_sub18+tlrc[shape#0_Coef]
p19 patient shape 0.09 singlesub/P_sub19.results/stats.P_sub19+tlrc[shape#0_Coef]
p20 patient shape 0.08 singlesub/P_sub20.results/stats.P_sub20+tlrc[shape#0_Coef]
p21 patient shape 0.67 singlesub/P_sub21.results/stats.P_sub21+tlrc[shape#0_Coef]
p22 patient shape 0.19 singlesub/P_sub22.results/stats.P_sub22+tlrc[shape#0_Coef]
p23 patient shape 0.36 singlesub/P_sub23.results/stats.P_sub23+tlrc[shape#0_Coef]
p24 patient shape 0.03 singlesub/P_sub24.results/stats.P_sub24+tlrc[shape#0_Coef]
p25 patient shape 3.09 singlesub/P_sub25.results/stats.P_sub25+tlrc[shape#0_Coef]
p26 patient shape -0.65 singlesub/P_sub26.results/stats.P_sub26+tlrc[shape#0_Coef]
p27 patient shape 0.53 singlesub/P_sub27.results/stats.P_sub27+tlrc[shape#0_Coef]
s02 control iaps -0.01 singlesub/C_sub02.results/stats.C_sub02+tlrc[iaps#0_Coef]
s03 control iaps 0.54 singlesub/C_sub03.results/stats.C_sub03+tlrc[iaps#0_Coef]
s05 control iaps 0.80 singlesub/C_sub05.results/stats.C_sub05+tlrc[iaps#0_Coef]
s06 control iaps 2.51 singlesub/C_sub06.results/stats.C_sub06+tlrc[iaps#0_Coef]
s07 control iaps 0.38 singlesub/C_sub07.results/stats.C_sub07+tlrc[iaps#0_Coef]
s08 control iaps 0.45 singlesub/C_sub08.results/stats.C_sub08+tlrc[iaps#0_Coef]
s09 control iaps 0.70 singlesub/C_sub09.results/stats.C_sub09+tlrc[iaps#0_Coef]
s11 control iaps 0.64 singlesub/C_sub11.results/stats.C_sub11+tlrc[iaps#0_Coef]
s12 control iaps 0.51 singlesub/C_sub12.results/stats.C_sub12+tlrc[iaps#0_Coef]
s13 control iaps 0.20 singlesub/C_sub13.results/stats.C_sub13+tlrc[iaps#0_Coef]
s14 control iaps 1.33 singlesub/C_sub14.results/stats.C_sub14+tlrc[iaps#0_Coef]
s15 control iaps 0.45 singlesub/C_sub15.results/stats.C_sub15+tlrc[iaps#0_Coef]
s17 control iaps 0.90 singlesub/C_sub17.results/stats.C_sub17+tlrc[iaps#0_Coef]
s18 control iaps 0.71 singlesub/C_sub18.results/stats.C_sub18+tlrc[iaps#0_Coef]
s19 control iaps 2.52 singlesub/C_sub19.results/stats.C_sub19+tlrc[iaps#0_Coef]
s20 control iaps -0.19 singlesub/C_sub20.results/stats.C_sub20+tlrc[iaps#0_Coef]
s21 control iaps -0.01 singlesub/C_sub21.results/stats.C_sub21+tlrc[iaps#0_Coef]
s22 control iaps 0.87 singlesub/C_sub22.results/stats.C_sub22+tlrc[iaps#0_Coef]
s23 control iaps 0.80 singlesub/C_sub23.results/stats.C_sub23+tlrc[iaps#0_Coef]
s24 control iaps 0.25 singlesub/C_sub24.results/stats.C_sub24+tlrc[iaps#0_Coef]
s26 control iaps 0.13 singlesub/C_sub26.results/stats.C_sub26+tlrc[iaps#0_Coef]
s27 control iaps 0.34 singlesub/C_sub27.results/stats.C_sub27+tlrc[iaps#0_Coef]
s28 control iaps 0.93 singlesub/C_sub28.results/stats.C_sub28+tlrc[iaps#0_Coef]
s29 control iaps 0.78 singlesub/C_sub29.results/stats.C_sub29+tlrc[iaps#0_Coef]
p01 patient iaps -0.13 singlesub/P_sub01.results/stats.P_sub01+tlrc[iaps#0_Coef]
p02 patient iaps 1.20 singlesub/P_sub02.results/stats.P_sub02+tlrc[iaps#0_Coef]
p03 patient iaps 2.34 singlesub/P_sub03.results/stats.P_sub03+tlrc[iaps#0_Coef]
p04 patient iaps 2.25 singlesub/P_sub04.results/stats.P_sub04+tlrc[iaps#0_Coef]
p05 patient iaps -0.34 singlesub/P_sub05.results/stats.P_sub05+tlrc[iaps#0_Coef]
p06 patient iaps 1.94 singlesub/P_sub06.results/stats.P_sub06+tlrc[iaps#0_Coef]
p07 patient iaps 0.36 singlesub/P_sub07.results/stats.P_sub07+tlrc[iaps#0_Coef]
p08 patient iaps 8.56 singlesub/P_sub08.results/stats.P_sub08+tlrc[iaps#0_Coef]
p09 patient iaps 9.47 singlesub/P_sub09.results/stats.P_sub09+tlrc[iaps#0_Coef]
p10 patient iaps 0.94 singlesub/P_sub10.results/stats.P_sub10+tlrc[iaps#0_Coef]
p11 patient iaps 0.15 singlesub/P_sub11.results/stats.P_sub11+tlrc[iaps#0_Coef]
p12 patient iaps 0.37 singlesub/P_sub12.results/stats.P_sub12+tlrc[iaps#0_Coef]
p13 patient iaps 0.56 singlesub/P_sub13.results/stats.P_sub13+tlrc[iaps#0_Coef]
p14 patient iaps 0.93 singlesub/P_sub14.results/stats.P_sub14+tlrc[iaps#0_Coef]
p15 patient iaps 0.96 singlesub/P_sub15.results/stats.P_sub15+tlrc[iaps#0_Coef]
p16 patient iaps 3.32 singlesub/P_sub16.results/stats.P_sub16+tlrc[iaps#0_Coef]
p17 patient iaps 0.02 singlesub/P_sub17.results/stats.P_sub17+tlrc[iaps#0_Coef]
p18 patient iaps 0.19 singlesub/P_sub18.results/stats.P_sub18+tlrc[iaps#0_Coef]
p19 patient iaps -1.69 singlesub/P_sub19.results/stats.P_sub19+tlrc[iaps#0_Coef]
p20 patient iaps -0.04 singlesub/P_sub20.results/stats.P_sub20+tlrc[iaps#0_Coef]
p21 patient iaps 0.72 singlesub/P_sub21.results/stats.P_sub21+tlrc[iaps#0_Coef]
p22 patient iaps 2.67 singlesub/P_sub22.results/stats.P_sub22+tlrc[iaps#0_Coef]
p23 patient iaps 5.70 singlesub/P_sub23.results/stats.P_sub23+tlrc[iaps#0_Coef]
p24 patient iaps 0.26 singlesub/P_sub24.results/stats.P_sub24+tlrc[iaps#0_Coef]
p25 patient iaps 7.50 singlesub/P_sub25.results/stats.P_sub25+tlrc[iaps#0_Coef]
p26 patient iaps -0.06 singlesub/P_sub26.results/stats.P_sub26+tlrc[iaps#0_Coef]
p27 patient iaps 0.20 singlesub/P_sub27.results/stats.P_sub27+tlrc[iaps#0_Coef]

Thank you for your assistance!

Irene

Irene, one possibility is the label for the input file column. Change “Inputfile” to “InputFile”, and see how it goes. Currently the program is quite finicky about the letter case.

Thanks Gang!

After changing to InputFile I got this error:

During startup - Warning message:
Setting LC_CTYPE failed, using “C”
Read 515 items
Error in [.data.frame(dataStr, , vars[ii]) : undefined columns selected
Calls: process.LME.opts … gl_Constr → glfConstr → levels → [ → [.data.frame
Execution halted

Which was fixed by adding a space before each colon in -gltCode:

3dLME -prefix LME_results2 -jobs 1
-model “GroupCategoryCorr”
-qVars “Corr”
-ranEff ‘~1’
-SS_type 3
-num_glt 4
-gltLabel 1 ‘Group’ -gltCode 1 ‘Group : 1control -1patient’
-gltLabel 2 ‘Category’ -gltCode 2 ‘Category : 1iaps’
-gltLabel 3 ‘GroupXCategory’ -gltCode 3 'Group : 1
control -1patient Category : 1iaps -1shape’
-gltLabel 4 ‘GroupXiapsXCorr’ -gltCode 4 'Group : 1
control -1patient Category : 1iaps Corr :’
-dataTable @do_LME_table.txt
-mask singlesub/GM_resample+tlrc

Of all the synthax variants I tried I hadnt thought of the space before the colons because with 3dmvm it works fine without the space.
The script now run uneventfully.

I wanted to ask you one last question, regarding whether you think the analysis is setup correctly. We are interested in looking at group differences in BOLD during “iaps” given the covariate of interest “Corr” (i.e. Do BOLD and covariate correlate differently across groups?). Therefore the glt 4.

Thank you and all the best,
Irene

Irene,

Of all the synthax variants I tried I hadnt thought of the space before the colons because with 3dmvm
it works fine without the space.

3dLME and 3dMVM share exactly the same syntax for GLT and GLF specifications.

I wanted to ask you one last question, regarding whether you think the analysis is setup correctly. We are
interested in looking at group differences in BOLD during “iaps” given the covariate of interest “Corr” (i.e.
Do BOLD and covariate correlate differently across groups?).

The model seems fine in general. Is ‘Category’ a within-subject variable? Do the groups differ substantially in “Corr”?

Thanks Gang!

The model seems fine in general. Is ‘Category’ a within-subject variable?

Yes. In reality it has 4 levels.

Do the groups differ substantially in “Corr”?

I compared the scores between groups for each level in the within-subject variable “Category”. When doing that I find no significant difference between the groups, except for one level (0.04).
When comparing the scores between groups across all within-subject levels, I find a significant difference between the groups.

How do you think is best to proceed? Shall I include -qVarsCenters ‘1.0532’, with 1.05532 as the overall average across “Group” and “Category”, or shal I run it without qVarsCenters?

Also, would it be justified to run independent 3dmvms with covariate on each within-subject level separately instead of having them all in the same model? Our main interest is to see group differences in the relationship between BOLD & covariate at each level, and not necessarily to compare the levels.

Thanks so muich for your help.

All the best,
Irene

would it be justified to run independent 3dmvms with covariate on each within-subject
level separately instead of having them all in the same model?

Yes, I think it would be more preferable to analyze the data at each level of the within-subject factor using 3dMVM or even 3dttest++. Regarding centering, think about how you would interpret the analysis results: Do the groups intrinsically differ in terms of the covariate? If they do, center around a value (mean or some meaningful value) within each group; otherwise simply center around an overall value.

Thank you Gang,

I have two follow-up questions:

  1. The output of glt4 from the initial 3dLME:

3dLME -prefix LME_results -jobs 1 \
-model “GroupCategoryCorr” \
-qVars “Corr” \
-ranEff ‘~1’ \
-SS_type 3 \
-num_glt 4 \
-gltLabel 1 ‘Group’ -gltCode 1 ‘Group : 1control -1patient’ \
-gltLabel 2 ‘iaps_vs_shape’ -gltCode 2 ‘Category: 1iaps -1shape’ \
-gltLabel 3 ‘GroupXCategory’ -gltCode 3 ‘Group : 1control -1patient Category : 1iaps -1shape’ \
[b]-gltLabel 4 ‘GroupXiapsXCorr’ -gltCode 4 ‘Group : 1control -1patient Category : 1*iaps Corr :’ [/b]
-dataTable @do_LME_table.txt \
-mask singlesub/GM_resample+tlrc

resulted in a significant cluster. If I understand correctly the glt4 contrast compares the beta-covariate correlation between groups.
When I pulled the betas from the significant cluster and run the correlation analysis in SPSS there were no significant correlations
for either groups. Could you help me understand why?

  1. Also, following your suggestion, I also tried to run the analysis on one of the levels of the within-subject factor and I get “model test failed!”.
    Do you see any mistakes in my script/table? I have N=25 participants per group.

3dMVM -prefix MVM_corr -jobs 35
-bsVars "GroupCorr"
-wsVars Category
-qVars Corr
-num_glt 3
-gltLabel 1 Group -gltCode 1 'Group : 1
control -1*patient’
-dataTable @do_mvm_corr_table.txt
-mask GM_MNI_resample+tlrc

Subj Group Category Corr InputFile
s01 control iaps 0.00 singlesub/C_sub02.results/stats.C_sub02+tlrc.BRIK’[iaps#0_Coef]’
s02 control iaps -0.05 singlesub/C_sub03.results/stats.C_sub03+tlrc.BRIK’[iaps#0_Coef]’
p01 patient iaps 2.36 singlesub/C_sub06.results/stats.C_sub06+tlrc.BRIK’[iaps#0_Coef]’
p02 patient iaps 0.05 singlesub/C_sub07.results/stats.C_sub07+tlrc.BRIK’[iaps#0_Coef]’

Thanks so much.

All the best,
Irene

Irene,

If ‘Corr’ is a within-subject quantitative variable, consider

-ranEff ‘~1+Corr’ \

If I understand correctly the glt4 contrast compares the beta-covariate correlation between groups.

More accurately, GLT #4 looks for the difference of association between beta and ‘Corr’ between the two group when Category is fixed at ‘iaps’.

When I pulled the betas from the significant cluster and run the correlation analysis in SPSS there
were no significant correlations for either groups. Could you help me understand why?

I’m not familiar with SPSS. If ‘Corr’ is a within-subject quantitative variable, how do you handle it in SPSS? You may try to extract one voxel, and try it in SPSS and see if you can duplicate the result from 3dLME.

For your 3dMVM script: change

-num_glt 3 \

to

-num_glt 1 \

Dear Gang,

Thanks for your help.

More accurately, GLT #4 looks for the difference
of association between beta and ‘Corr’ between the
two group when Category is fixed at ‘iaps’.

Am I right in interepting association as correlation? If not could you please explain what you mean with association?
My main struggle is to find ways to make this 3-way interaction interpretable.
How would you suggest to proceed in order to understand what this significant cluster reflects?

If ‘Corr’ is a within-subject quantitative variable, consider
-ranEff ‘~1+Corr’ \

Unfortuantely the model still failed. I noticed that when adding an additional within-subject level in the table the same script run fine.
This setup wont be the appropriate way of performing the analysis since the Covariate is within-subject but I thought that this information might help with figuring out where the error might be. Any ideas why?

3dMVM -prefix MVM_corr -jobs 35
-bsVars "GroupCorr"
-wsVars Category
-qVars Corr
-ranEff’~1+Corr’ \
-num_glt 1
-gltLabel 1 Group -gltCode 1 'Group : 1
control -1*patient’
-dataTable @do_mvm_corr_table.txt
-mask GM_MNI_resample+tlrc

Subj Group Category Corr InputFile
s01 control iaps 0.00 singlesub/C_sub01.results/stats.C_sub01+tlrc.BRIK’[iaps#0_Coef]’
s02 control iaps -0.05 singlesub/C_sub02.results/stats.C_sub02+tlrc.BRIK’[iaps#0_Coef]’
p01 patient iaps 2.36 singlesub/P_sub01.results/stats.P_sub01+tlrc.BRIK’[iaps#0_Coef]’
p02 patient iaps 0.05 singlesub/P_sub02.results/stats.P_sub02+tlrc.BRIK’[iaps#0_Coef]’
s01 control shape 0.00 singlesub/C_sub01.results/stats.C_sub01+tlrc.BRIK’[iaps#0_Coef]’
s02 control shape -0.05 singlesub/C_sub02.results/stats.C_sub02+tlrc.BRIK’[iaps#0_Coef]’
p01 patient shape 2.36 singlesub/P_sub01.results/stats.P_sub01+tlrc.BRIK’[iaps#0_Coef]’
p02 patient shape 0.05 singlesub/P_sub02.results/stats.P_sub02+tlrc.BRIK’[iaps#0_Coef]’

Thank you for your help!

All the best,
Irene

Am I right in interepting association as correlation?

Yes, they are the same thing.

My main struggle is to find ways to make this 3-way interaction interpretable.
How would you suggest to proceed in order to understand what this significant cluster reflects?

To further unpack the following contrast

-gltLabel 4 ‘GroupXiapsXCorr’ -gltCode 4 ‘Group : 1control -1patient Category : 1*iaps Corr :’ \

you can add two more GLTs to help you sort out the above contrast:

‘Group : 1control Category : 1iaps Corr :’
‘Group : 1patient Category : 1iaps Corr :’ \

For the scripting problem, the following

3dMVM -prefix MVM_corr -jobs 35 \
-bsVars “Group*Corr” \
-wsVars Category \
-qVars Corr \

should be for 3dLME:

3dLME -prefix MVM_corr -jobs 35 \
-bsVars “Group*Corr” \
-wsVars Category \
-qVars Corr \

Also,

ranEff’~1+Corr’ \

should be

-ranEff ‘~1+Corr’ \

Thank you Gang,

I added the GLTs:

‘Group : 1control Category : 1iaps Corr :’ \
‘Group : 1patient Category : 1iaps Corr :’ \

For the controls I get basically all the clusters I had for the initial 3-way GroupiapsCorr interaction. The t-scores are all negative for these clusters.
For the patients I dont get anything.

Can I conclude that the controls have a significant negative correlation between iaps and Corr, whereas the patient dont?

Thanks you,

All the best,
Irene

Can I conclude that the controls have a significant negative correlation between iaps and Corr, whereas the patient dont?

Your conclusion is about right, but your wording can be a little bit more accurate. First, the negative correlation itself between iaps and Corr in the control group is not necessarily “significant” (the value can be large or small). Instead, you have strong statistical evidence (so-called statistical significance) for the negative correlation between iaps and Corr in the control group. Second, it is not necessarily true that the patient group does not have significant negative correlation between iaps and Corr; rather, you don’t have strong statistical evidence (e.g., statistical significance) for the correlation between iaps and Corr in the patient group. Therefore, your description “For the patients I dont get anything” is not really correct. In other words, the correlation in patients is likely not all zero, but you cannot differentiate them from zero with strong evidence or confidence. Lastly, you may want to interpret these two results together with the GLT #4:

-gltLabel 4 ‘GroupXiapsXCorr’ -gltCode 4 ‘Group : 1control -1patient Category : 1*iaps Corr :’ \