I’m interested in running an unpaired t-test in 3dttest++ comparing functional connectivity (of amygdala ROI) between 2 groups while controlling for categorical (Site (4 levels), Maternal Education (3 levels)) and continuous (Father’s Age) covariates of no-interest.
Is this the correct way to code for categorical variables of no-interest that have more than two levels in 3dttest++?
It looks fine if you assume there are no interactions among all the explanatory variables.
is there a significant difference in the interpretation of the results when coding using 1/-1 versus 0.5/-0.5?
The only difference is: with 1/-1 coding, the variable is associated with half of the group difference (i.e., (A - B) / 2) while with 0.5/-0.5 coding, the variable is associated with the group difference (i.e., A - B).
I have thought more about my research question and have a few follow-up questions that I hope to get some help on. For context: I have 2 groups (HR: high risk for autism; LR: low risk for autism) with an uneven number of subjects in each group. I’m interested in the difference in amygdala functional connectivity between the groups, as well as how Brain Volume (continuous variable) is associated with connectivity. In total I have 3 covariates of no-interest as I mentioned in my initial message (Site, Maternal Education, Father’s Age), and also 1 covariate of interest (Brain Volume). This leads me to two follow-up questions:
I was reading through the documentation on 3dttest++, which states that “Only the -paired and -pooled options can be used with covariates.” I cannot run a paired t-test (since I have an uneven number of subjects in each group) and I want to avoid the subtraction technique described in the documentation. Would it be better/appropriate to use 3dMVM (since I can incorporate covariates there too)?
Regarding centering for the continuous covariates: Father’s Age is significantly different between the two groups (and I would like to “regress out” the effect of this covariate), but Brain Volume is not significantly different between the two groups (however, I expect the relationship between Brain Volume and amygdala functional connectivity to be different between the two groups; this is a covariate of interest). I have revisited this helpful link, but wanted to check - would it make sense to not demean either variable? Or would it make more sense to demean Brain Volume (since I expect the slopes to be different between the two groups) but not to demean for Father’s Age (since I want to regress out the effect)? I’m a little lost at this point thinking through the potential possibilities! What would you recommend in terms of centering as I know that it strongly impacts the interpretation?
I cannot run a paired t-test (since I have an uneven number of subjects in each group)
You have two groups, not two conditions; so it’s not a “paired” situation. You should be fine using 3dttest++. However, it would be much easier to set it up in your situation with 3dMVM since you would not have to take care of the dummy coding issue.
Father’s Age is significantly different between the two groups (and I would like to “regress out” the effect of this covariate)
It depends on whether you want to model the interaction between Father’s Age and the Group. If yes, it would make sense to properly center Father’s Age. If no, you don’t have to center this variable.
Brain Volume is not significantly different between the two groups
Similar to the situation with Father’s Age, the impact of centering is on the interpretation of the group difference, not on the covariate effect. Also, it’s better to think about how you would like to interpret the difference between the two groups instead of whether the two groups differ in Brain Volume.
Thank you for the suggestion for 3dMVM - after reading through the documentation on 3dMVM, it does seem to be much easier for my situation. I wanted to make sure I understand - is the reason behind why dummy coding is not necessary for 3dMVM because the program can accept explanatory variables that are categorical (i.e., factors) in addition to explanatory variables that are quantitative (based on the Usage described here)?
Seems like this would work since I have 3 between-subject factors (Group with 2 categorical levels; Site with 4 categorical levels; MEdu with 3 categorical levels) and 1 quantitative covariate of no-interest (FatherAge) and 1 quantitative covariate of interest (BrainVolume).
My goal is to run two models - first looking at the main effect of Group, and then looking at the interaction between Group*BrainVolume. I looked through the examples on the 3dMVM documentation, but could not find an example of modeling an interaction between a categorical factor and a quantitative covariate. Would the setup below be correct for 1) modeling main effect of group, and 2) modeling this type of interaction?
Main effect of Group (essentially I want to model FC ~ Group + Site + FatherAge + MEdu, where Site, FatherAge, and MEdu are covariates of no-interest):
Interaction between GroupBrainVolume (I want to model [u]FC ~ Group + Site + FatherAge + MEdu + BrainVolume + GroupBrainVolume[/u], where again Site, FatherAge, and MEdu are covariates of no-interest):
is the reason behind why dummy coding is not necessary for 3dMVM because the program can accept explanatory variables
that are categorical (i.e., factors) in addition to explanatory variables that are quantitative?
The user does not need to dummy code categorical variables because 3dMVM (and other programs such as 3dLME and 3dLMEr) dummy code them internally.
Would the setup below be correct for 1) modeling main effect of group, and 2) modeling this type of interaction?
It would be better to adopt one model for all of your research hypotheses. Try something like
Thanks for the explanation re: internal dummy coding for 3dMVM - very nifty!
I will try using just one model for all of my hypotheses - but since I am not interested in modeling the interaction between Group and FatherAge (i.e., I just want to regress out the effect of FatherAge as a covariate of no-interest to control for it), would the following be appropriate?
I’m encountering some issues with running 3dMVM where it will read the input files but throw the following error:
Reading input files now…
Reading input files: Done!
If the program hangs here for more than, for example, half an hour,
kill the process because the model specification or the GLT coding
is likely inappropriate.
Possible reasons:
0) Make sure that R packages afex and phia have been installed. See the 3dMVM
help documentation for more details.
1) Inappropriate model specification with options -bsVars, -wsVars, or -qVars.
Note that within-subject or repeated-measures variables have to be declared
with -wsVars.
2) Incorrect specifications in general linear test coding with -gltCode.
3) Mistakes in data table. Check the data structure shown above, and verify
whether there are any inconsistencies.
4) Inconsistent variable names which are case sensitive. For example, factor
named Group in model specification and then listed as group in the table header
would cause grief for 3dMVM.
5) Not enough number of subjects. This may happen when there are two or more
withi-subject factors. For example, a model with two within-subject factors with
m and n levels respectively requires more than (m-1)*(n-1) subjects to be able to
model the two-way interaction with the multivariate approach.
I believe that each of the possible reasons for model test failure are satisfied, so I'm confused as to what could be causing the issue. Any ideas for what might be the cause?
For reference, this is what my code looks like:
```
3dMVM -prefix PREFIXNAME -jobs 5 \
-bsVars "Group+Sex+MEdu" \
-num_glt 2 \
-gltLabel 1 HR -gltCode 1 'Group : 1*HR' \
-gltLabel 2 LR -gltCode 2 'Group : 1*LR' \
-dataTable @datatable.txt
```
where datatable.txt is:
```
Subj Group Sex MEdu InputFile
sub01 LR Male 2 sub01/ROI.nii.gz
sub02 HR Male 4 sub02/ROI.nii.gz
sub03 LR Male 4 sub03/ROI.nii.gz
sub04 HR Male 4 sub04/ROI.nii.gz
sub05 HR Male 3 sub05/ROI.nii.gz
sub06 LR Male 3 sub06/ROI.nii.gz
sub07 HR Male 3 sub07/ROI.nii.gz
sub08 HR Male 4 sub08/ROI.nii.gz
sub09 HR Male 4 sub09/ROI.nii.gz
sub10 HR Female 3 sub10/ROI.nii.gz
sub11 HR Male 4 sub11/ROI.nii.gz
sub12 HR Male 3 sub12/ROI.nii.gz
sub13 HR Male 4 sub13/ROI.nii.gz
sub14 HR Female 2 sub14/ROI.nii.gz
sub15 HR Male 2 sub15/ROI.nii.gz
sub16 LR Female 4 sub16/ROI.nii.gz
sub17 HR Male 2 sub17/ROI.nii.gz
sub18 LR Female 4 sub18/ROI.nii.gz
sub19 HR Male 4 sub19/ROI.nii.gz
sub20 LR Female 4 sub20/ROI.nii.gz
sub21 HR Female 4 sub21/ROI.nii.gz
sub22 HR Male 3 sub22/ROI.nii.gz
sub23 HR Female 2 sub23/ROI.nii.gz
sub24 HR Female 3 sub24/ROI.nii.gz
sub25 HR Male 3 sub25/ROI.nii.gz
sub26 HR Male 4 sub26/ROI.nii.gz
sub27 HR Male 2 sub27/ROI.nii.gz
sub28 HR Female 2 sub28/ROI.nii.gz
sub29 HR Female 3 sub29/ROI.nii.gz
sub30 HR Female 3 sub30/ROI.nii.gz
sub31 HR Male 2 sub31/ROI.nii.gz
sub32 HR Female 3 sub32/ROI.nii.gz
sub33 HR Male 2 sub33/ROI.nii.gz
sub34 HR Male 3 sub34/ROI.nii.gz
sub35 HR Female 3 sub35/ROI.nii.gz
sub36 LR Female 3 sub36/ROI.nii.gz
sub37 HR Male 3 sub37/ROI.nii.gz
sub38 HR Male 4 sub38/ROI.nii.gz
sub39 HR Male 2 sub39/ROI.nii.gz
sub40 HR Male 3 sub40/ROI.nii.gz
sub41 LR Male 4 sub41/ROI.nii.gz
sub42 LR Male 4 sub42/ROI.nii.gz
sub43 LR Male 2 sub43/ROI.nii.gz
sub44 HR Female 4 sub44/ROI.nii.gz
sub45 HR Female 4 sub45/ROI.nii.gz
sub46 HR Female 2 sub46/ROI.nii.gz
sub47 HR Female 3 sub47/ROI.nii.gz
sub48 HR Female 2 sub48/ROI.nii.gz
sub49 HR Male 3 sub49/ROI.nii.gz
sub50 HR Female 2 sub50/ROI.nii.gz
sub51 HR Male 3 sub51/ROI.nii.gz
sub52 HR Male 2 sub52/ROI.nii.gz
sub53 HR Male 2 sub53/ROI.nii.gz
sub54 HR Male 3 sub54/ROI.nii.gz
sub55 HR Male 3 sub55/ROI.nii.gz
sub56 HR Male 2 sub56/ROI.nii.gz
sub57 HR Male 2 sub57/ROI.nii.gz
sub58 LR Female 4 sub58/ROI.nii.gz
sub59 LR Female 3 sub59/ROI.nii.gz
sub60 LR Male 2 sub60/ROI.nii.gz
sub61 LR Male 3 sub61/ROI.nii.gz
sub62 LR Male 3 sub62/ROI.nii.gz
sub63 HR Male 4 sub63/ROI.nii.gz
sub64 HR Male 4 sub64/ROI.nii.gz
sub65 HR Male 4 sub65/ROI.nii.gz
sub66 HR Male 4 sub66/ROI.nii.gz
sub67 HR Male 3 sub67/ROI.nii.gz
sub68 LR Male 4 sub68/ROI.nii.gz
sub69 HR Male 2 sub69/ROI.nii.gz
sub70 HR Female 3 sub70/ROI.nii.gz
sub71 LR Female 4 sub71/ROI.nii.gz
sub72 LR Female 4 sub72/ROI.nii.gz
sub73 HR Female 3 sub73/ROI.nii.gz
sub74 HR Male 4 sub74/ROI.nii.gz
sub75 LR Male 3 sub75/ROI.nii.gz
sub76 LR Female 3 sub76/ROI.nii.gz
sub77 LR Male 3 sub77/ROI.nii.gz
sub78 HR Female 4 sub78/ROI.nii.gz
sub79 LR Male 3 sub79/ROI.nii.gz
sub80 LR Male 3 sub80/ROI.nii.gz
sub81 LR Male 4 sub81/ROI.nii.gz
sub82 HR Male 3 sub82/ROI.nii.gz
sub83 HR Female 4 sub83/ROI.nii.gz
sub84 HR Male 2 sub84/ROI.nii.gz
sub85 HR Female 2 sub85/ROI.nii.gz
sub86 LR Male 4 sub86/ROI.nii.gz
sub87 LR Male 3 sub87/ROI.nii.gz
```
I also ran afni_system_check.py -check_all to see whether there might be an issue with my version of R (since I had run into that issue in the past), and here is the output of that (and everything seems to look ok?):
-------------------------------- general ---------------------------------
architecture: 64bit
system: Darwin
release: 19.6.0
version: Darwin Kernel Version 19.6.0: Thu May 6 00:48:39 PDT 2021; root:xnu-6153.141.33~1/RELEASE_X86_64
distribution: 10.15.7 x86_64
number of CPUs: 16
apparent login shell: bash
shell RC file: .bashrc (exists)
--------------------- AFNI and related program tests ---------------------
which afni : /Users/liuj10/abin/afni
afni version : Precompiled binary macosx_10.7_local: Aug 28 2018
: AFNI_18.2.15
AFNI_version.txt : AFNI_18.2.15, macosx_10.7_local, Aug 28 2018
which python : /usr/bin/python
python version : 2.7.16
which R : /usr/local/bin/R
R version : R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
which tcsh : /bin/tcsh
instances of various programs found in PATH:
afni : 1 (/Users/liuj10/abin/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/3.6/Resources/bin/R)
python : 1 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
python2 : 1 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
python3 : 2
/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/bin/python3.9
/usr/bin/python3
testing ability to start various programs...
afni : success
suma : success
3dSkullStrip : success
uber_subject.py : success
3dAllineate : success
3dRSFC : success
SurfMesh : success
3dClustSim : success
checking for R packages...
rPkgsInstall -pkgs ALL -check : success
checking for $HOME files...
.afnirc : found
.sumarc : found
.afni/help/all_progs.COMP : found
------------------------------ python libs -------------------------------
** python module not found: PyQt4
-- PyQt4 is no longer needed for an AFNI bootcamp
-------------------------------- env vars --------------------------------
PATH = /usr/local/ANTs/bin:/Users/liuj10/opt/anaconda2/condabin:/usr/local/fsl/bin:/usr/local/DTIPrepTools-0.1.1-Linux/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/MATLAB_R2019a.app/bin:/opt/X11/bin:/Users/liuj10/abin:/Users/liuj10/abin
PYTHONPATH =
R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) = /opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =
------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas : found TT_N27+tlrc under /Users/liuj10/abin
------------------------------ OS specific -------------------------------
which brew : /usr/local/bin/brew
brew version : Homebrew 3.1.12
-- for PyQt4 under brew, consider running:
brew install cartr/qt4/pyqt
-- consider installing gcc under homebrew
++ found valid link /usr/local/lib/libglib-2.0.dylib
to ../Cellar/glib/2.68.3/lib/libglib-2.0.dylib
++ found 1 dylib files under '/opt/X11/lib/flat_namespace'
-- found 'libXt' dylib files:
/opt/X11/lib/flat_namespace/libXt.6.dylib
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell 'bash'...
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in shell 'tcsh'...
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace
========================= summary, please fix: =========================
* login shell 'bash', trusting user to translate from 'tcsh'
* shell bash: consider sourcing (non-login) .bashrc from (login) .bash_profile
* insufficient data for AFNI bootcamp
Any ideas as to what could be incorrect in my 3dMVM code or why I'm getting this error?
Thank you!
Janelle
As an update - I tried testing the model as follows:
Including Group+Sex (taking out MEdu) - This still failed (same error message).
Including Group+MEdu (taking out Sex) - This is working!
I think it might be because when I include Sex and MEdu as additional factors, the contingency tables look like this:
Contingency tables of subject distributions among the categorical variables:
, , MEdu = 2
Sex
Group Female Male
HR 7 12
LR 0 3
, , MEdu = 3
Sex
Group Female Male
HR 9 14
LR 3 8
, , MEdu = 4
Sex
Group Female Male
HR 5 14
LR 6 6
where among subjects who have MEdu=2, there are no female LR subjects. Is there a way to still include Sex as a factor without the program erroring out?
As a side note, I am interested in the main effect of Group and am including Sex and MEdu as covariates of no interest.
I was just responding to your previous message while your update came in! Yes, you already found out the problem: when MEdu = 2, there are no Female subjects in the LR group:
Sex
Group Female Male
HR 7 12
LR 0 3
Is there a way to still include Sex as a factor without the program erroring out?
Unfortunately you cannot have both Sex and MEdu in the same model using 3dMVM, but I’m not sure why the model ‘Group+Sex’ failed. If you want me to dig it deeper, I may have to ask you to share a testing dataset for diagnosis.
On the other hand, try using 3dttest++ with -1/1 coding for Sex ang MEdu, and it may work in this case.
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.