3dttest++ -paired cluster directionality ?

Hi Afni experts,
I ran a paired ttest (subjects in same order for group A and B) and used -BminusA such that group B is subtracted from group A. From this, the negative blue clusters suggest GroupA > GroupB, and positive red clusters are GroupA < GroupB. I then created a cluster mask of the significant voxels, and then extracted nonzero mean values. When looking at the raw nonzero mean values (3dROIstats with cluster as mask), the raw GroupB mean values were larger than raw GroupA mean values, suggesting that GroupA < GroupB, even though the cluster tstat suggests Group B > Group A. Is there a reason why the ttest directionality and raw values do not match? Does a paired ttest default to only AminusB even if -BminusA is specified?

3dttest++ -prefix ./3dttest/PostvsPre -BminusA -setA Pre Sub1 ‘Pre/Sub1.nii[0]’ Sub2 ‘Pre/Sub2.nii[0]’ Sub3 ‘Pre/Sub3.nii[0]’ -setB Post Sub1_2 ‘Post/Sub1_2.nii[0]’ Sub2_2 ‘Post/Sub2_2.nii[0]’ Sub3_2 ‘Post/Sub3_2.nii[0]’ -mask ~/Documents/ROI_1mm/mask.nii -paired -center SAME


Hi Afni Experts,
As a follow up I switched groups A and B and also switched to AminusB. In this case I got group A >B which matches the raw data values. For some reason when I use BminusA and have groups BAnd A switched (effectively the same thing), the Tstat directionality is reversed of the raw data. Could this be a bug?


There is a bug. The problem was that when ‘-BminusA’ is used, the program could end up changing the sign of the results TWICE – probably some leftover old code wasn’t removed by some unnameable august personage.

I have fixed this problem in the source code, which is now on GitHub. I will start a rebuild of the binaries tonight, so using @update.afni.binaries tomorrow morning (Friday, 14 Oct 2016) should make your life less confusing.

Hi Bob,
Thanks for the update regarding the issue and quick fix.