How do I get p-values from 3dDeconvolve t-tests

Hello everyone, and happy new year.

I am trying to carry on an analysis of BOLD and ASL signal, in which I would like to threshold the beta weights coefficients that have been calculated through 3dDeconvolve’s regression.

I can get the t_statistics and F_statistics for every voxel/coefficient, but I don’t know any simple way to mask the ones that have a p-value < 0.001.

Also, is there a way to get the full baselin in one value ?
I need to use the baseline in calculations.

Thanks for any help.

Hi-

There are a lot of ways to go about this depending on you preferred outputs.

The first thing to note is that the datasets output by AFNI statistical programs (3dttest++, 3dMVM, 3dMEMA, etc.) have the information stored in each statistical sub-volume to convert the given statistic to a p-value. They do this by knowing the associated degrees of freedom (DFs) and anything else necessary.

If you have a p-value and you want to know what the associate stat value is for a given sub-volume, you can use p2dsetstat. For example, you just need to provide the subvolume of interest (which can be done with bracket selectors—you likely should use either single or double quotes around those in a shell script), the p-value of interest, and the sidedness of the test (1-sided, 2-sided or bisided). For example:

p2dsetstat                                  \
    -inset stats.sub01+tlrc'[2]'            \
    -pval 0.001                             \
    -bisided

We have commented in detail how 2-sided or bisided testing is typically most appropriate for t-tests in MRI, even though many times people choose 1-sided t-testing (often problematically):

For F-stats, you would only use 1-sided.

The above command will output a mini-table of information (including the DFs). For scripting purposes you could include the -quiet command, just outputting the number then, and saving that to a variable that could be used, say, in a 3dcalc command for thresholding:

#!/bin/tcsh

set my_stat = `p2dsetstat                                  \
                   -inset stats.sub01+tlrc'[2]'            \
                   -pval 0.001                             \
                   -bisided                                \
                   -quiet`
echo "++ My statistic value is: ${my_stat}"

# make a single mask where t>my_stat and t<-my_stat
3dcalc                                                     \
    -a stats.sub01+tlrc'[2]'                               \
    -expr "step(a-${my_stat})+step(-${my_stat}-a)"                             \
    -prefix DSET_THR_MASK_2sided_tstat.nii.gz 

Note that that will just be a single mask of the positive and negative t-values whose magnitudes are larger than my_stat. Also note that instead of always using the numerical index to select a sub-volume ('[2]', above), you can use the string label from the AFNI header, such as something like '[vis#0_Tstat]'

3dClusterize might also be a nice option. You can use the value of my_stat as a threshold, or specifically use the p-value on the command line. If you don’t want any cluster-size thresholding done, you can have the -clust_nvox .. value be 1. You can also threshold on the sub-volume specified with the index-for-thresholding (ithr) and output the associated coefficient or “data” map map output (specified with the index-of-the-data subvolume, -idat ..), with the thresholding applied:

3dClusterize                  \
    -inset stats.sub01+tlrc'[2]'   \
    -ithr 2                    \
    -idat 1                    \
    -mask mask_group+tlrc.     \
    -NN 2                      \
    -clust_nvox 1              \
    -bisided p=0.001           \
    -pref_map ClusterMap       \
    -pref_dat ClusterEffEst

Of course, you can also apply a cluster-based thresholding value, if you have that.

So, a few different options, depending on what you really want.

–pt

1 Like