Skip to main content
Department of Psychiatry Department of Psychiatry

AFNI Notes: 10/11/2019 [12/8/2025]
Good AFNI summary (pdf)

It is good to check the available data: R_datacheck.R

Test Description Comment
3dttest++ a relatively flexible voxel based t-test really good option for obvious contrasts
3dttest as above without new features largely decommissioned
3dMEMA like 3dttest++ but uses t-stat for scaling needs REML, conceptually cool, not sure of benefit
3dMannWhitney non parametric 2 group ttest non-paired maybe if the data is just that noisy
3dKruskalWallis as above for >2 groups or multiple noisy datasets
3dWilcoxon paired 2 group non parametric etc.
3dFriedman as above for >2 groups etc.
3dLME a nice general LM frame work good option for interactions etc.
3dMVM like 3dLME with a few less bells if your comfortable with LME just stay with that
3dANOVAx Does x way ANOVAs as it needs equal groups and other reasons don't use
3dRegAna Does multiple regression as it does calculations in short and other reasons don't use
3dLMEr More optimal for longitudinal I tend to use this a bunch
3dGLMM Extention of GLMM uses marginal means
3dMSS Multilevel Smoothing-Spline Pretty output but tricky to use

More details on 3dttest++

 

3dttest++ Student T test with 1 or 2 sets of data (labeled 'A' and 'B').
-prefix p p = output
-mask mmm mmm = specified mask.
-setA/-setB Use this to specify group membership
1 group just give setA to contrast with base 0 [or setB versus -singletonA 10/perfect10+tlrc'[1]']
2 group will give setA-setB, setA(v. null), and setB(v. null) [-BminusA flips contrast]
Short form: -labelA Group1 -setA mydatasub1+tlrc'[1]' mydatasub2+tlrc'[1]' … etc.
Long form: -setA Group1 sub1 mydatasub1+tlrc'[1]' sub2 mydatasub2+tlrc'[1]' … etc.

-covariates COVAR_FILE a text file with a table for numeric covariate(s)[columns] for each subj[rows]
Rows must match dataset label example:
subject IQ age GMfrac
Elvis 143 42 Elvis_GM+tlrc[8]
Fred 85 59 Fred_GM+tlrc[8]
Ethel 109 49 Ethel_GM+tlrc[8]
Lucy 133 32 Lucy_GM+tlrc[8]
Ricky 121 37 Ricky_GM+tlrc[8]
can only be used with the short form '-setX' option if each input dataset has only 1 sub-brick
-center NONE/DIFF/SAME do you remove mean of covariates? Group or set mean? [default DIFF]
-paired is the data paired. If paired setA will be ignored
-pooled/unpooled for un/pooled variance (blocks covariates)
-toz Convert output t-statistics to z-scores
-rankize Convert the data (and covariates, if any)
-brickwise run ttest on each subbrick for each brick provided
-resid q q = Output residuals to look at with 3dFWHMx
-randomsign makes better residuals by flipping directionality
-clustsim will run 10000 iteration clustsim and apply results to file
-Clustsim keep .1D files
-CLUSTSIM keep all temp files
-ETAC Equitable Thresholding And Clustering
-prefix_clustsim cc cc = prefix of clustsimfiles

Thoughts on ClustSim: 

Thoughts on ETAC: Article

More Details on 3dLME(r)

3dLME Multivariate Linear Model

-jobs NJOBS processors
-prefix Output file
-mask MASK Process voxels inside this mask only.
-model FORMULA Test of model like '~A*B+C+A:B" + = factors; : = interaction * = both (A*B = A+B+A:B)
-model (3dLMEr) uses lmerTest and formulates random factors example: (1|Subj) 
-SS_type NUMBER Specify the type for sums of squares: 1=sequential 3=marginal
-qVars variable_list comma separated list of quantitative variables
-qVarCenters VALUES comma separated list of means of quantitative variables [default = group mean]
-vVars variable single voxel-wise covariate, i.e. subXTime1+tlrc column in dataTable
-vVarCenters VALUE centering values for voxel-wise covariates [default=mean of all subjects]
-ranEff FORMULA Specify the random effects. For just Subjects = "~1" but could be"~1+RT"
-num_glf/num_glt NG number of general linear F-tests/t-tests
-glfCode/gltCode k CODING Specify the k-th general linear F-test/t-test
Coding example: 'Condition : 1*A -1*B & 1*A -1*C Emotion : 1:pos'

  • Weights don't need to sum to 0
  • If covariate is not given the mean is used
  • If a categorical is not given the mean of all levels I used

-glfLabel/gltLabel k label Specify the label for the k-th GLF/GLT
-dataTable
List the data structure with a header as the first line.

  • Last item command
  • Header on first line must start with Subj and end with InputFile
  • Can be a file '-dataTable @table.txt'
Other interesting:
-corStr FORMULA Correlation structure of the residuals (like AR or ARMA) if timeseries entered.
-cutoff threshold: Specify the cutoff value to obtain voxel-wise accuracy [default is 0]
-ICC intra-class correlation [for variables in -ranEff]
-LOGIT Do logistic regression [no random effects]

Making a dataTable is key

dataTable rules:

  • top row is header
  • first column of heading is Subj and it ends with InputFile
  • you don't need to do the quotes around subbricks (like on commandline)
  • tab deliniated
you can build this with awk or R code example: MakeDataTable.csh