« 3dpc | Software | ctf2matlab »
3dFDR3dFDR is an AFNI program for controlling the multiple comparisons problem in any statistical test (t-test, ANOVA, etc.). It works by generating a new statistical threshold that predicts the percent of false positives at a given p-value. The new threshold, called a q-value, is generated from the distribution of p-values in your data. The output of the program is a sorted list of p-values with a q-value associated with each one. Standard q-value thresholds are .05 or .1, indicating predicted 5% or 10% false positives among all significant voxels. The test is much less conservative than Bonferroni and is easier to implement than family-wise corrections. It is also valid under situations of high positive correlations in a dataset, which we typically have in neighboring SAM voxels. 3dFDR can also be used to give a common threshold for a SAM sliding window dataset using the combined p-values from t-tests at each time slice.
3dFDR [options] StatisticalData+tlrc
The help menu incorrectly states that the default -cind option is only valid for independent p-values. This is incorrect; -cind should be used for both independent p-values and cases where positive correlations between p-values are expected (as is the case for SAM datasets). -cdep is more conservative and should only be used for datasets with more complex positive and negative correlations (hardly ever true for SAM).
Here is a sample script for calculating a single FDR threshold for multiple t-tests performed at each window of a SAM sliding window dataset. The sample sliding window data has 38 time points and 20 subjects.
for i in `seq 0 37`;
do
3dttest -session RESULTS -prefix ttest_${i} -base1 0 \
-set2 set1+tlrc\[$i] set2+tlrc\[$i] \
set3+tlrc\[$i] set4+tlrc\[$i] \
set5+tlrc\[$i] set6+tlrc\[$i] \
set7+tlrc\[$i] set8+tlrc\[$i] \
set9+tlrc\[$i] set10+tlrc\[$i] \
set11+tlrc\[$i] set12+tlrc\[$i] \
set13+tlrc\[$i] set14+tlrc\[$i] \
set15+tlrc\[$i] set16+tlrc\[$i] \
set17+tlrc\[$i] set18+tlrc\[$i] \
set19+tlrc\[$i] set20+tlrc\[$i]
3dcalc -t RESULTS/ttest_${i}+tlrc[1] -expr "fitt_t2p(t,19)" -prefix RESULTS/ttest_${i}_p
3dmaskdump -noijk -mask N27_mask_newgrid+tlrc RESULTS/ttest_${i}_p+tlrc >> ttest_Pvalues
done
3dFDR -input1D ttest_Pvalues -list -cind > ttest_Qvalues
A trick using brace expansion for generating the 3dttest -set2 list in bash goes like this:
slist={`seq -s, 1 20`}
...
set2=`eval echo set$slist+tlrc\[$i]`
eval 3dttest -session RESULTS -prefix ttest_${i} -base1 0 \
-set2 $set2
A single list of p-values from t-tests at each window is generated in a loop. 3dFDR is then used to associate q-values with the sorted list of p-values. The output file ttest_Qvalues will look something like this:
Index p-value q-value z-score
......
29449 0.020939 0.049972 1.960204
10796 0.020943 0.049980 1.960139
95533 0.020943 0.049980 1.960139
80055 0.020944 0.049981 1.960127
10186 0.020945 0.049982 1.960116
108282 0.020946 0.049984 1.960104
37049 0.020948 0.049986 1.960080
45878 0.020948 0.049986 1.960080
105672 0.020951 0.049993 1.960028
31238 0.020952 0.049993 1.960024
64705 0.020952 0.049993 1.960024
71425 0.020953 0.049994 1.960013
13603 0.020954 0.049996 1.960001
51660 0.020957 0.050000 1.959966
69209 0.020957 0.050000 1.959966
105685 0.020957 0.050000 1.959966
22420 0.020958 0.050001 1.959954
72279 0.020960 0.050005 1.959922
52726 0.020961 0.050006 1.959910
27627 0.020964 0.050012 1.959857
44890 0.020968 0.050021 1.959784
84083 0.020970 0.050025 1.959752
......
Here we see that a q-value of .05, representing a 5% chance of a false positive, is associated with a p-value of .020957.