3dLME

Hi,

I was wondering if my 3dLME model is correct. I am trying to look at changes in myelination from session 1 to 3, while controlling for age and gender effects. I only have one group, so no between-subjects factors.

Thanks.

module load AFNI
module load R/3.2.0-goolf-1.7.20

3dLME -prefix /path_to_dir/myelin_gm-masked.nii
-mask /path_to_mask/gm_mask_v2.nii
-model ‘Session+Age+Gender’
-qVars ‘Age,Gender’
-ranEff ‘~1’
-SS_type 3
-num_glt 3
-gltLabel 1 ‘s1-s2’ -gltCode 1 ‘Session : +1ses-01 -1ses-02’
-gltLabel 2 ‘s1-s3’ -gltCode 2 ‘Session : +1ses-01 -1ses-03’
-gltLabel 3 ‘s2-s3’ -gltCode 3 ‘Session : +1ses-02 -1ses-03’
-dataTable
Subj Session Age Gender InputFile
sub-patient01 ses-01 25 1 /path_to_data/subjects/sub-patient01/ses-01/anat/wemt1w_on_t2w_masked.nii
sub-patient03 ses-01 28 2 /path_to_data/subjects/sub-patient03/ses-01/anat/wemt1w_on_t2w_masked.nii
sub-patient01 ses-02 25 1 /path_to_data/subjects/sub-patient01/ses-02/anat/wemt1w_on_t2w_masked.nii
sub-patient03 ses-02 28 2 /path_to_data/subjects/sub-patient03/ses-02/anat/wemt1w_on_t2w_masked.nii
sub-patient01 ses-03 25 1 /path_to_data/subjects/sub-patient01/ses-03/anat/wemt1w_on_t2w_masked.nii
sub-patient03 ses-03 28 2 /path_to_data/subjects/sub-patient03/ses-03/anat/wemt1w_on_t2w_masked.nii \

I only have one group, so no between-subjects factors.

It is better to treat “gender” as a factor unless you really know how to dummy-code a categorical variable and interpret the results. Otherwise, you have two genders, so “gender” is a between subjects factor.

A couple of questions:

  1. Do you have missing data?
  2. Do the two genders have substantially different average age?

It is better to treat “gender” as a factor unless you really know how to dummy-code a categorical variable and interpret the results. Otherwise, you have two genders, so “gender” is a between subjects factor.

that is true. My bad.

A couple of questions:

  1. Do you have missing data?

No, all subjects have data

  1. Do the two genders have substantially different average age?

No, they dont differ substantially on age.

In that case, it’s more straightforward to simply use 3dMVM (and use multiple processors with option -jobs if possible):

3dMVM -prefix /path_to_dir/myelin_gm-masked.nii \
-mask /path_to_mask/gm_mask_v2.nii \
-bsVars ‘AgeGender’
-wsVars ‘Session’
-qVars ‘Age’ \
-num_glt 3 \
-gltLabel 1 ‘s1-s2’ -gltCode 1 'Session : +1
ses-01 -1ses-02’ \
-gltLabel 2 ‘s1-s3’ -gltCode 2 'Session : +1
ses-01 -1ses-03’ \
-gltLabel 3 ‘s2-s3’ -gltCode 3 'Session : +1
ses-02 -1*ses-03’

and this will let me look at the effect of session while controlling for the effects of age and gender, correct? Like an omnibus F-test

Yes, that’s correct.

Lastly, the sub brick that will tell give me the omnibus F test of session while controlling for age and gender is Age:Gender:Session F brick, correct? See the attached image.

Thank you

Screen Shot 2019-01-30 at 9.35.09 AM.png

the sub brick that will tell give me the omnibus F test of session while controlling
for age and gender is Age:Gender:Session F brick, correct?

No, that’s the three-way interaction between the 3 variables. What you want is sub-brick “#4 Sesssion F”

Hi,
Now I would like to run 3dLME because I have some subjects who have missing data, e.g., some subjects have 2 sessions (baseline and 6 weeks) while others have 3 sessions (baseline, week6, and week16) which would allow me to use more subjects. Also, I wanted it to use because each subject may have a unique intercept (baseline myelin content) as well as a slope (change in myelin from baseline to wee6 or week16). I am controlling for age and gender effects.

Question 1 is whether my 3dLME script looks correct (more specifically the model and ranEff flags; see below)

Question 2 is how do I include missing data? See sub-patient02 on the InputFile column below (has the first 2 sessions, but not a 3rd session)

Thanks

3dLME -prefix /path_to_dir/myelin_gm-masked.nii \
-mask /path_to_mask/gm_mask_v2.nii \
-model ‘Session+Age+Gender’ \
-qVars ‘Age’ \
-ranEff ‘~1+Session’ \
-SS_type 3 \
-num_glt 3 \
-gltLabel 1 ‘s1-s2’ -gltCode 1 ‘Session : +1ses-01 -1ses-02’ \
-gltLabel 2 ‘s1-s3’ -gltCode 2 ‘Session : +1ses-01 -1ses-03’ \
-gltLabel 3 ‘s2-s3’ -gltCode 3 ‘Session : +1ses-02 -1ses-03’ \
-dataTable \
Subj Session Age Gender InputFile \
sub-patient01 ses-01 25 1 /path_to_data/subjects/sub-patient01/ses-01/anat/wemt1w_on_t2w_masked.nii \
sub-patient02 ses-01 18 1 /path_to_data/subjects/sub-patient02/ses-01/anat/wemt1w_on_t2w_masked.nii \
sub-patient03 ses-01 28 0 /path_to_data/subjects/sub-patient03/ses-01/anat/wemt1w_on_t2w_masked.nii \
sub-patient01 ses-02 25 1 /path_to_data/subjects/sub-patient01/ses-02/anat/wemt1w_on_t2w_masked.nii \
sub-patient02 ses-02 18 1 /path_to_data/subjects/sub-patient02/ses-02/anat/wemt1w_on_t2w_masked.nii \
sub-patient03 ses-02 28 0 /path_to_data/subjects/sub-patient03/ses-02/anat/wemt1w_on_t2w_masked.nii \
sub-patient01 ses-03 25 1 /path_to_data/subjects/sub-patient01/ses-03/anat/wemt1w_on_t2w_masked.nii \
sub-patient02 ses-03 18 1
sub-patient03 ses-03 28 0 /path_to_data/subjects/sub-patient03/ses-03/anat/wemt1w_on_t2w_masked.nii \

-model ‘Session+Age+Gender’ \

Are you sure that you don’t believe there would be no interactions among those 3 variables?

-ranEff ‘~1+Session’ \

Change it to

-ranEff ‘~1’ \

how do I include missing data?

Do nothing since you don’t have anything for the missing data to be added to the data table.

-model ‘Session+Age+Gender’ \
Are you sure that you don’t believe there would be no interactions among those 3 variables?

We are trying to account for age and gender on the analysis. How would I create such interactions then? SessionAgeGender?

-ranEff ‘~1+Session’ \
Change it to -ranEff ‘~1’ \

Wouldn’t “~1+Session” mean that each subject has a unique intercept as well as a slope? This is a longitudinal design

how do I include missing data?
Do nothing since you don’t have anything for the missing data to be added to the data table.

Basically just omit the row with the missing brain data then, right?

Thanks a lot

Sorry again.

-model ‘Session+Age+Gender’ \
Are you sure that you don’t believe there would be no interactions among those 3 variables?

We are trying to account for age and gender on the analysis. How would I create such interactions then? SessionAgeGender?

-ranEff ‘~1+Session’ \
Change it to -ranEff ‘~1’ \

Wouldn’t “~1+Session” mean that each subject has a unique intercept as well as a slope? This is a longitudinal design

how do I include missing data?
Do nothing since you don’t have anything for the missing data to be added to the data table.

Basically just omit the row with the missing brain data then, right?

Thanks a lot

As I couldn’t post my message here due to some formatted symbols, I sent you my response through an email on Feb. 19. You didn’t get it?

Hi Gang,

This thread has been useful but I have a few additional questions:

We are using 3dLME over 3dMVM because:

  1. missing data
  2. multiple random effects (e.g., site, family, sibling)
  3. w/s repeated continuous measures (e.g., age at time 1 and time 2)

My questions are as follows:

  1. How do you specify the random effect for multiple variables? Ignoring age (see question 2), would this be correct?

    Rx effects: site (category 1-8), family_ID (continuous categorical), sib (factor)
    Btwn subjects: group
    W/n subject: time
    Covariates: sex, handedness, IQ_PR, IQ_VC

3dLME -prefix filename -jobs 12
-model “group*time+sex+handedness+IQ_PR+IQ_VC+site+family_ID+sib”
-qVars “sex,handedness,IQ_PR,IQ_VC”
-ranEff “~1”
-SS_type 3
-dataTable
Subj group age time sex handedness IQ_PR IQ_VC site family_ID sib InputFile
000000240546 case 14.48767123 BSL 0 1 131 140 4 143 0 EPI_stop_signal/con_0002_stop_success.nii.gz
000000240546 case 19.63016545 FU2 0 1 131 140 4 143 0 EPI_stop_signal/con_0002_stop_success.nii.gz
000000871047 case 14.44657534 BSL 1 1 112 117 2 147 1 EPI_stop_signal/con_0003_stop_success.nii.gz
000000871047 case 18.5479721 FU2 1 1 112 117 2 147 1 EPI_stop_signal/con_0003_stop_success.nii.gz \

  1. Age issue:
    Age is both a within subject and between subject factor. Therefore, would this be correct?

3dLME -prefix filename -jobs 12
-model “grouptimeage+age+sex+handedness+IQ_PR+IQ_VC+site+family_ID+sib”
-qVars “age, sex,handedness,IQ_PR,IQ_VC”
-ranEff “~1”
-SS_type 3
-dataTable
Subj group age time sex handedness IQ_PR IQ_VC site family_ID sib InputFile
000000240546 case 14.48767123 BSL 0 1 131 140 4 143 0 EPI_stop_signal/con_0002_stop_success.nii.gz
000000240546 case 19.63016545 FU2 0 1 131 140 4 143 0 EPI_stop_signal/con_0002_stop_success.nii.gz
000000871047 case 14.44657534 BSL 1 1 112 117 2 147 1 EPI_stop_signal/con_0003_stop_success.nii.gz
000000871047 case 18.5479721 FU2 1 1 112 117 2 147 1 EPI_stop_signal/con_0003_stop_success.nii.gz \

  1. Also, since age is w/s and there is variance between interval between time 1 (BSL) and time 2 (FU2) do I need to estimate a random slope for age?

3dLME -prefix filename -jobs 12
-model “grouptimeage+age+sex+handedness+IQ_PR+IQ_VC+site+family_ID+sib”
-qVars “age,sex,handedness,IQ_PR,IQ_VC”
-ranEff “~1+age”
-SS_type 3
-dataTable \

  1. How do you specify the random effect for multiple variables? Ignoring age (see question 2), would this be correct?
    Rx effects: site (category 1-8), family_ID (continuous categorical), sib (factor)

Could you describe a little bit more about these 3 variables and explain why you consider them as random-effects variables? If you treat them as random-effects variables, they should not be included in the model specification because that is for fixed-effects variables:

-model “group*time+sex+handedness+IQ_PR+IQ_VC+site+family_ID+sib” \

Age is both a within subject and between subject factor.

Do you mean that ‘Age’ varies within subject? Is this a longitudinal study? If so, yes you can do:

-ranEff “~1+age” \

3dLME is not so flexible in dealing with crossed random-effects. Alternatively a region-based approach would be much handy in terms of handling such a scenario: https://afni.nimh.nih.gov/afni/community/board/read.php?1,157054,157054#msg-157054

Could you describe a little bit more about these 3 variables and explain why you consider them as random-effects variables? If you treat them as random-effects variables, they should not be included in the model specification because that is for fixed-effects variables:

  1. Gotcha. So just to be clear, ranEff “~1” will estimate random intercepts for any variables specified in the dataTable that are NOT in the model?
  2. Site, family ID and sibling are nested (and not crossed) random effects. The data were collected at multiple sites and contains siblings (i.e., family_ID) and twins/triplets (i.e., sib). There are different numbers of subjects and siblings/twins per site. Therefore, we want to include these factors as nested random effects.

Do you mean that ‘Age’ varies within subject? Is this a longitudinal study? If so, yes you can do: -ranEff “~1+age” \

  1. Yes, age varies within subject
  2. Yes, this is a longitudinal study which means that the interval of the variation is different between subjects. For example, sub 1 is scanned at 14.2 yo and then again at 19.9 = 5.7 years vs sub 2 scanned at 14.9 and 19.0 = 4.1 years

To sum it up, would this be the correct way to model random effects for site, family_ID, sib plus the random slope for age?:

3dLME -prefix filename -jobs 12 \
-model “grouptimeage+age+sex+handedness+IQ_PR+IQ_VC” \
-qVars “age,sex,handedness,IQ_PR,IQ_VC” \
-ranEff “~1+age” \
-SS_type 3 \
-dataTable
Subj group age time sex handedness IQ_PR IQ_VC site family_ID sib InputFile \

So just to be clear, ranEff “~1” will estimate random intercepts for any variables specified in the
dataTable that are NOT in the model?

No, the current implementation in 3dLME only considers “subjects” as the only random-effects variable.

Site, family ID and sibling are nested (and not crossed) random effects. The data were collected
at multiple sites and contains siblings (i.e., family_ID) and twins/triplets (i.e., sib). There are
different numbers of subjects and siblings/twins per site. Therefore, we want to include these
factors as nested random effects.

An intricate dataset!

  1. How many subjects do you have within each site?
  2. How families? Are they all twins/triplets? Do you differentiate monozygotic (MZ) and dizygotic (DZ) twins/triplets?

We are working with two large datasets (separate research projects) with thousands of subjects (n1= 2000 and n2=6000). N2 has twins and triplets (MZ and DZ) while the other only has siblings. Eventually, we will code for MZ and DZ but for now, we just want to control for site and family. There are about 500ish subjects per site and not every family has multiple children enrolled. Every family has a unique ID while sibling/twin, the triplet is coded as 0,1,2,3.

two large datasets (separate research projects) with thousands of subjects (n1= 2000 and n2=6000)

Memory could be an issue, but I assume you have access to a super computer?

N2 has twins and triplets (MZ and DZ) while the other only has siblings. Eventually, we will code for MZ
and DZ but for now, we just want to control for site and family. There are about 500ish subjects per site
and not every family has multiple children enrolled. Every family has a unique ID while sibling/twin, the
triplet is coded as 0,1,2,3.

Do you have other explanatory variables such as subject traits or behavior measures? The current implementation in 3dLME is not well-suited for the complexity involved in your case. I may have to write a separate program with a small testing dataset to handle the situation.

Hi Gang,

Yes, we do have other explanatory variables (e.g., behavioral measurements, BMI, traits etc). It is a large dataset. Solving the issue of nested random effects will be useful for multiple projects.

I would really appreciate your help.