Skip to content

linwangmeyer/python_permutationTest

Repository files navigation

python_permutationTest

python scripts for running permutation tests to MEG source activation results across participants

These scripts were used to run permutation tests across different spatial ROIs between two conditions. Detailed illustration of the statistial approach is below:

For each contrast of interest, we tested hypotheses using mass univariate statistics with permutation-based cluster mass procedures to account for multiple comparisons (Marris & Oostenveld, 2007). Within each time window, we carried out pairwise t-tests on the signed estimated dSPM values at each vertex and at each sampling point. Instead of using the resulting signed t-values to compute our cluster-level statistic, we used unsigned -log-transformed p values. This is because, if located on one side of a sulcus, a single neuroanatomical source can appear on the surface as adjacent groups of dipoles of opposite polarity (outgoing and ingoing) because of signal bleeding to the other side of the sulcus (Hämäläinen, et al., 1993). This is clearly apparent in the activation movies which depict the signed dSPM values at each location in each condition: the positive dSPM values, corresponding to outgoing dipoles and shown in red, and the negative dSPM values, corresponding to ingoing dipoles and shown in blue, were often observed on either side of a sulcus. The use of unsigned p values therefore ensured that adjacent effects of the opposite signs were treated as a single cluster/single underlying source. Within our time window of interest, any data points that exceeded a pre-set uncorrected significance threshold of 1% (i.e., p ≤ 0.01) was -log10 transformed (e.g., -log10(0.01) = 2, -log10(0.001) = 3), and the rest were zeroed.

In order to account for multiple spatial comparisons across the search area, we subdivided the area into 140 equal-sized patches (Khan et al. 2018). Within each patch, we took the average of the -log-transformed p values across all time points within each time window of interest (300-500ms and 600-1000ms) as our cluster statistic. We then carried out exactly the same procedure as described above, but this time we randomly assigned dSPM values between the two conditions for a given contrast. This was repeated 10,000 times. For each randomization, we took the largest cluster mass statistic across all spatial patches, and in this way, created a null distribution for the cluster mass statistic. To test our hypotheses at each spatial patch in each time window of interest, we compared the observed cluster-level statistic for that patch against the null distribution. If our observed cluster-level statistic fell within the highest 5.0% of the distribution, we considered it to be significantly activated. This cluster-based method allowed us to account for temporal and spatial discontinuities in effects (resulting from noise). However, it constrains any statistical inference to the spatial resolution of each patch and the temporal resolution of our a priori time windows.

In order to illustrate the results, we projected the averaged uncorrected -log10 transformed p-values (p < 0.05) at each vertex on to the fsaverage brain. We use circles to indicate any spatial patches in which we observed a significant or near-significant cluster, grouping these areas by the anatomical regions illustrated in Figure X. In order to interpret whether any significant differences between conditions were driven by differences in the magnitude or the direction of the dipoles produced in each conditions, we examined the dSPM movies for each of the conditions separately, frame by frame within each time window of interest.

About

python scripts for running permutation tests to MEG source activation results across participants

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages