3dLME for scatter plot

Dear AFNI experts and users,
After running the 3dLME as below, I find a significant result in “-gltLabel 8 after_before_in_anode_now_or_notnow”. Does anyone know how to extract the effect of ‘after-before’ in anode for each individual in the current model? Then I can use them for scatter plot.
Thanks.
All the best.
Rujing

3dLME -prefix Example3 -jobs 1
-ML
-resid Cancha
-qVars “age,education”
-model “CiJiQainHouContrast3+age+education”
-mask …/newaal_50+tlrc
-ranEff ‘~1’
-SS_type 3
-num_glt 12
-gltLabel 1 anode_sham -gltCode 1 ‘CiJi : 1anode -1sham’
-gltLabel 2 anode_sham_in_after_now -gltCode 2 ‘CiJi : 1anode -1sham QainHou : 1after Contrast3 : 1now’
-gltLabel 3 anode_sham_in_after_notnow -gltCode 3 ‘CiJi : 1anode -1sham QainHou : 1after Contrast3 : 1notnow’
-gltLabel 4 anode_sham_in_after_now_notnow -gltCode 4 ‘CiJi : 1anode -1sham QainHou : 1after Contrast3 : 1now -1notnow’
-gltLabel 5 anode_sham_in_after_now_or_notnow -gltCode 5 'CiJi : 1
anode -1sham QainHou : 1after Contrast3 : 1now +1notnow’
-gltLabel 6 after_before_in_anode_now -gltCode 6 ‘CiJi : 1anode QainHou : 1after -1before Contrast3 : 1now’
-gltLabel 7 after_before_in_anode_notnow -gltCode 7 ‘CiJi : 1anode QainHou : 1after -1before Contrast3 : 1notnow’
-gltLabel 8 after_before_in_anode_now_or_notnow -gltCode 8 ‘CiJi : 1anode QainHou : 1after -1before Contrast3 : 1now +1notnow’
-gltLabel 9 CiJi_x_QianHou_now -gltCode 9 'CiJi : 1
anode -1sham QainHou : 1after -1before Contrast3 : 1now’
-gltLabel 10 CiJi_x_QianHou_notnow -gltCode 10 ‘CiJi : 1anode -1sham QainHou : 1after -1before Contrast3 : 1notnow’
-gltLabel 11 CiJi_x_QianHou_now_notnow_3inter -gltCode 11 'CiJi : 1
anode -1sham QainHou : 1after -1before Contrast3 : 1now -1notnow’
-gltLabel 12 CiJi_x_QianHou_now_or_notnow -gltCode 12 'CiJi : 1
anode -1sham QainHou : 1after -1before Contrast3 : 1now +1*notnow’
-dataTable
Subj CiJi QainHou Contrast3 sex age education InputFile
sub02 anode before notnow 1 25 19 sub02_ddt2_notnow_anode_before.txt+tlrc
sub02 anode before now 1 25 19 sub02_ddt2_now_anode_before.txt+tlrc
sub02 anode after notnow 1 25 19 sub02_ddt2_notnow_anode_after.txt+tlrc
sub02 anode after now 1 25 19 sub02_ddt2_now_anode_after.txt+tlrc
sub02 sham before notnow 1 25 19 sub02_ddt2_notnow_sham_before.txt+tlrc
sub02 sham before now 1 25 19 sub02_ddt2_now_sham_before.txt+tlrc
sub02 sham after notnow 1 25 19 sub02_ddt2_notnow_sham_after.txt+tlrc
sub02 sham after now 1 25 19 sub02_ddt2_now_sham_after.txt+tlrc
sub03 anode before notnow 1 25 18 sub03_ddt2_notnow_anode_before.txt+tlrc
sub03 anode before now 1 25 18 sub03_ddt2_now_anode_before.txt+tlrc
sub03 anode after notnow 1 25 18 sub03_ddt2_notnow_anode_after.txt+tlrc
sub03 anode after now 1 25 18 sub03_ddt2_now_anode_after.txt+tlrc
sub03 sham before notnow 1 25 18 sub03_ddt2_notnow_sham_before.txt+tlrc
sub03 sham before now 1 25 18 sub03_ddt2_now_sham_before.txt+tlrc
sub03 sham after notnow 1 25 18 sub03_ddt2_notnow_sham_after.txt+tlrc
sub03 sham after now 1 25 18 sub03_ddt2_now_sham_after.txt+tlrc
sub04 anode before notnow 1 28 20 sub04_ddt2_notnow_anode_before.txt+tlrc
sub04 anode before now 1 28 20 sub04_ddt2_now_anode_before.txt+tlrc
sub04 anode after notnow 1 28 20 sub04_ddt2_notnow_anode_after.txt+tlrc
sub04 anode after now 1 28 20 sub04_ddt2_now_anode_after.txt+tlrc
sub04 sham before notnow 1 28 20 sub04_ddt2_notnow_sham_before.txt+tlrc
sub04 sham before now 1 28 20 sub04_ddt2_now_sham_before.txt+tlrc
sub04 sham after notnow 1 28 20 sub04_ddt2_notnow_sham_after.txt+tlrc
sub04 sham after now 1 28 20 sub04_ddt2_now_sham_after.txt+tlrc \

Does anyone know how to extract the effect of ‘after-before’ in anode for each individual in the current model?

By “anode” do you mean a voxel or an anatomically or statistically defined region? First, define your voxel coordinates or a mask for the region, then extract the values from each subject using 3dmaskdump -xbox (or -ibox) or 3dmaskave -mask

Hi Gang,
Nope, the “anode” did not mean a voxel or an anatomically or statistically defined region. The “anode” is one condition of within-subject variable “CiJi”. Similarly, the “QainHou” (two level: after vs before) and the “Contrast3” (two level: now vs notnow) variables are within-subject variables.
In the current LME model, effect of this Lable is significant: -gltLabel 6 after_before_in_anode_now -gltCode 6 ‘CiJi : 1anode QainHou : 1after -1before Contrast3 : 1now’ . That is to say, in the “anode” “now” condition, there was a significant difference between “after” and “before” conditions. Therefore, I tried to extract the data in the “anode” “now” condition for “after” and “before” condition separately, then data were fed into a paired t-test. However, t-test revealed that group comparison between “after” and “before” conditions on the data was not significant. I guess one reason for ‘not significant in the t-test, but significant in the LME’ is that: in the LME, the model was modelling many effects, including interactions and main effects of ‘CiJi’, ‘QainHou’, ‘Contrast3’, and main effects of age, education. In contrast, in the t-test, these effects were not modelled. Is that correct?
So is there any method to extract the only/simple effect of ‘after’ - ‘before’ in the ‘anode’ ‘now’ condition while regressing out interactions and main effects of ‘CiJi’, ‘QainHou’, ‘Contrast3’ (these were within-subject variables)?
Thanks.
All the best.
Rujing

In the current LME model, effect of this Lable is significant: -gltLabel 6 after_before_in_anode_now -gltCode 6 ‘CiJi : 1anode QainHou : 1after -1before Contrast3 : 1now’ . That is to say, in the “anode” “now” condition, there was a significant difference between “after” and “before” conditions. Therefore, I tried to extract the data in the “anode” “now” condition for “after” and “before” condition separately, then data were fed into a paired t-test.

The proper way to do this is to add two more specifications:

-gltCode … ‘CiJi : 1anode QainHou : 1after Contrast3 : 1now’
-gltCode … 'CiJi : 1
anode QainHou : 1before Contrast3 : 1now’ \

Then combining with the original one -gltCode 6 ‘CiJi : 1anode QainHou : 1after -1before Contrast3 : 1now’, you should be able to sort out the details. Similarly for the other contrasts in your 3dLME script.

I guess one reason for ‘not significant in the t-test, but significant in the LME’ is that: in the LME, the model was modelling many effects, including interactions and main effects of ‘CiJi’, ‘QainHou’, ‘Contrast3’, and main effects of age, education. In contrast, in the t-test, these effects were not modelled. Is that correct?

You have other explanatory variables plus more factor levels in the LME model. In contrast, your paired t-test does not take those variables into consideration. These are two different models.

Hi Gang,

The proper way to do this is to add two more
specifications:

-gltCode … ‘CiJi : 1anode QainHou : 1after
Contrast3 : 1now’
-gltCode … 'CiJi : 1
anode QainHou : 1before
Contrast3 : 1
now’ \

Then combining with the original one -gltCode 6
‘CiJi : 1anode QainHou : 1after -1before
Contrast3 : 1
now’, you should be able to sort out
the details. Similarly for the other contrasts in
your 3dLME script.

Is there any method to plot coefficient, SD/SE of this effect '-gltCode … ‘CiJi : 1anode QainHou : 1after Contrast3 : 1*now’?
Thanks.
All the best.

Is there any method to plot coefficient, SD/SE of this effect '-gltCode … ‘CiJi : 1anode QainHou : 1after Contrast3 : 1*now’?

Each post hoc inference through -gltCode gives you two values per voxel: effect estimate and t-statistic. You can directly obtain the standard error (dividing effect estimate by t-statistic). Once you have the standard error, I think there is a way to plot the result at the voxel level although I don’t know the detail on the AFNI GUI. For ROI-level plotting, do it with a graphical tool after extracting the resutls.

Gang Wrote:

Each post hoc inference through -gltCode gives you
two values per voxel: effect estimate and
t-statistic. You can directly obtain the standard
error (dividing effect estimate by t-statistic).
Once you have the standard error, I think there is
a way to plot the result at the voxel level
although I don’t know the detail on the AFNI GUI.
For ROI-level plotting, do it with a graphical
tool after extracting the resutls.

Only considering the ROI-level plotting.
1, 3dLME return Z value, and how can it be transformed into t value?
2, The standard error and effect estimate could be used to bar plot with error bars. Could this bar-errorbar plot be transformed into scatter-point plot? Could I use residuals plus the effect estimate to measure the individual datapoint for scatter-plot?

Thanks.
Rujing

3dLME return Z value, and how can it be transformed into t value?

In this case, standard error is beta divided by Z-value

Could this bar-errorbar plot be transformed into scatter-point plot? Could I use residuals plus the effect estimate to
measure the individual datapoint for scatter-plot?

If you really want to show scatterplot with data of a hierarchical/multilevel structure, things might be much more complicated than simple models such as conventional regression. See an example here:

http://doingbayesiandataanalysis.blogspot.com/2019/07/shrinkage-in-hierarchical-models-random.html

Dear Gang
Thank you very much.
All the best.
Rujing

Hi Gang,
Besides the Z and SE, how to measure the 95% confidence interval?
Thanks
Rujing

You can use beta +/- 2*SE as the 95% uncertainty interval.

Hi Gang
Got it. Thanks very much.
Rujing