z-scores using 3dttest++ using -Clustsim converted to t-scores?

I am currently using 3dttest++ with the -Clustsim option which I just realized produces z-scores rather than the traditional t-scores produced by 3dttest++ without the -Clustsim option, and I am trying to create effect size maps using Cohens d. I usually use the following command which derives cohens d from the t-scores and the n of each group:

3dcalc -a resultsfile -prefix resultsfile_Cohensd -expr ‘a*sqrt(0.XXXX)’ <---- this value is usually derived by calculation using n1 and n2

But… this is meant for t-scores rather than z-scores, so I am wondering if there is a way to convert the z-scores to t-scores? I see that the option -toz was implicit within the -Clustsim option and I am wondering if there is a another command that I can use to either turn this option off or to convert to t-scores? Maybe I am missing something obvious? Thanks so much for your help!


Yes, although the 3dcalc expression is a little clumsy. The method is to (1) convert the z-statistic to its CDF value and then (2) convert that CDF value to a t-statistic with the desired number of degrees of freedom (DOF) – you need to supply the DOF parameter.

The expression is like this


where DOF is the degrees of freedom parameter. Generally, this would be one of the following:
1-sample t-test: number of input datasets - 1 - number of covariates
2-sample t-test: number of inputs in setA plus number of inputs in set B - 2 - 2*number of covariates
However, special cases are the 2-sample paired test (which is really the same as a 1-sample test) and the 2-sample unpooled variance estimate (where the DOF varies among voxels, and you might as well use the standard 2-sample formula above).

A sample command to see the effect of this mapping function is:

1deval -xzero -4 -del 0.01 -num 801 -expr ‘cdf2stat(stat2cdf(x,5,0,0,0),3,10,0,0)’ | 1dplot -xzero -4 -del 0.01 -stdin -xlabel z -ylabel ‘t(10)’

I set the DOF parameter to 10 here so you can see the effect. For larger DOF parameters, the effect gets smaller – that is, the graph of t vs z gets closer to being a straight line.

Thank you so much for your help with this. I think I am probably missing something obvious (I am a rather new afni user), but I tried using the command you provided to convert the z-score brik into a t-score brik so that I could display effect size maps in afni. To do this I typed:

3dcalc -a 3dttest++FACES_Csim_WB+tlrc -prefix 3dttest++FACES_Csim_WB_ZtoT -expr ‘a*cdf2stat(stat2cdf(x,5,0,0,0),3,44,0,0)’

The only thing I changed from the expression you provided was to add in the DOF=44. The command seemed to run, but then when I open it in afni, the values are much higher than would be expected of t-values when I select the z-score brik. And while the sagital view looks correct, I am only showing a band of data in the axial and coronal views, so I am wondering if I was supposed to replace some of the other values in the expression with values that correspond to my data? Or am I supposed to be using 3dcalc in a different way? I also tried selecting only subbrik [1] which corresponds to the z-score file, but that produced the same outcome.Please let me know if it would help to see the data and I will send it your way.


I had assumed you were more familiar with 3dcalc.

Your mistake is twofold. First, you used ‘-a’ to define the input, whereas in my formula, I used the variable name ‘x’, so you should use ‘-x’ to give input dataset name (or change the ‘x’ in the stat2cdf function to ‘a’). Second, you multiplied the function calls by ‘a’, which is not write. You could try this

3dcalc -a 3dttest++FACES_Csim_WB+tlrc -prefix 3dttest++FACES_Csim_WB_ZtoT -expr ‘cdf2stat(stat2cdf(a,5,0,0,0),3,44,0,0)’

If you do not give a dataset definition for variable ‘x’ (with the ‘-x’ option), then the program uses the x spatial coordinate for the value ‘x’ in the expression. For voxels a long ways from the brain center, x can be large (60-70), so no wonder you got ginormous values out!

That worked perfectly. Thank you so much! I really appreciate your help.

That worked perfectly! Thank you very much for time.