9.6.3. Statistical testing of a second-level analysis¶
Perform a one-sample t-test on a bunch of images (a.k.a. second-level analyis in fMRI) and threshold the resulting statistical map.
This example is based on the so-called localizer dataset. It shows activation related to a mental computation task, as opposed to narrative sentence reading/listening.
18.104.22.168. Prepare some images for a simple t test¶
This is a simple manually performed second level analysis.
/home/nicolas/anaconda3/envs/nilearn/lib/python3.8/site-packages/numpy/lib/npyio.py:2405: VisibleDeprecationWarning: Reading unicode strings without specifying the encoding argument is deprecated. Set the encoding, use None for the system default. output = genfromtxt(fname, **kwargs)
Get the set of individual statstical maps (contrast estimates)
22.214.171.124. Perform the second level analysis¶
First, we define a design matrix for the model. As the model is trivial (one-sample test), the design matrix is just one column with ones.
Next, we specify and estimate the model.
Compute the only possible contrast: the one-sample test. Since there is only one possible contrast, we don’t need to specify it in detail.
Threshold the resulting map: false positive rate < .001, cluster size > 10 voxels.
Now use FDR <.05 (False Discovery Rate) and no cluster-level threshold.
The FDR=.05 threshold is 2.37
Now use FWER <.05 (Family-Wise Error Rate) and no cluster-level threshold. As the data has not been intensively smoothed, we can use a simple Bonferroni correction.
The p<.05 Bonferroni-corrected threshold is 4.88
126.96.36.199. Visualize the results¶
First, the unthresholded map.
Second, the p<.001 uncorrected-thresholded map (with only clusters > 10 voxels).
<nilearn.plotting.displays.OrthoSlicer object at 0x7f4e88e504f0>
Third, the fdr-thresholded map.
<nilearn.plotting.displays.OrthoSlicer object at 0x7f4e694a1be0>
Fourth, the Bonferroni-thresholded map.
<nilearn.plotting.displays.OrthoSlicer object at 0x7f4e681d93a0>
These different thresholds correspond to different statistical guarantees: in the FWER-corrected image there is only a probability smaller than .05 of observing any false positive voxel. In the FDR-corrected image, 5% of the voxels found are likely to be false positive. In the uncorrected image, one expects a few tens of false positive voxels.
Total running time of the script: ( 0 minutes 16.241 seconds)