# Cluster permutation statistics for PAC

**URL:** <https://mne.discourse.group/t/cluster-permutation-statistics-for-pac/11138>\
**Category:** Support & Discussions\
**Tags:** eeg, statistics\
**Created:** [April 28, 2025, 5:21am UTC](https://mne.discourse.group/t/cluster-permutation-statistics-for-pac/11138 "2025-04-28T05:21:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonokat](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/bonokat/32/1901_2.png) [@bonokat](https://mne.discourse.group/u/bonokat)\
**Post date:** [April 28, 2025, 5:21am UTC](https://mne.discourse.group/t/cluster-permutation-statistics-for-pac/11138/1 "2025-04-28T05:21:48Z")

</div>

- MNE version: 1.8.0
- operating system:Windows 10

Hi All,

I am trying to run permutation cluster stats on my phase-amplitude coupling (PAC) data and having some issues with implementation.

**My data structure:**

pac\_all - numpy array of shape (24, 60, 20, 20) (participants x electrodes x phase\_frequency x amplitude\_frequency)  
I don’t have epochs dimension, since the PAC values vere computed on concatenated epochs for each participant.

There is no contrast between conditions so far, _I want to know the significant PAC values for each electrode separately_.

**Here’s my code:**

```python
# Compute adjacency matrix
sensor_adjacency, ch_names = mne.channels.find_ch_adjacency(epochs.info, "eeg")

adjacency = mne.stats.combine_adjacency(
   sensor_adjacency, pac_all.shape[2], pac_all.shape[3]
)

```

> > > sensor\_adjacency.shape = (60, 60)  
> > > adjacency.shape = (24000, 24000)

```python
# We want a one-tailed test, since PAC values are positive numbers
tail = 1
t_thresh = scipy.stats.t.ppf(1 - 0.01, df=degrees_of_freedom) # np.float64(2.4998667394943976)

# Set the number of permutations to run
n_permutations = 1000

# Run the analysis
T_obs, clusters, cluster_p_values, H0 = permutation_cluster_1samp_test(
    pac_all,
    n_permutations=n_permutations,
    threshold=12,
    tail=tail,
    adjacency=adjacency,
    out_type="mask",
    max_step=1,
    verbose=True,
)

```

> > > T\_obs.mean() = np.float64(8.314733192984257)  
> > > len(clusters) = 1  
> > > cluster\_p\_values = array([0.001])

_Why do I only get one cluster?_  
Even if I increase the threshold to 8 and get 9 clusters, all the cluster\_p\_values are equal to 0.001, which does not seem right.

_How can I visualise the output for each electrode to see what is going on?_  
(to see significant PAC values in colour and all the rest - in black and white)

_Am I passing the right structure to the test at all?_  
I am using the tutorial for TF stats analysis as a reference, where the structure of the data is (n\_obs x electrodes x phase\_frequency x amplitude\_frequency)

---

<div class="post-metadata">

**Author:** ![sotpapad](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sotpapad/32/2184_2.png) [@sotpapad](https://mne.discourse.group/u/sotpapad)\
**Post date:** [May 2, 2025, 7:21am UTC](https://mne.discourse.group/t/cluster-permutation-statistics-for-pac/11138/2 "2025-05-02T07:21:42Z")

</div>

Hi,

I don’t know what is wrong, but since you are interested in analyzing each channel separately couldn’t you try doing the analysis per channel anyway, [as in this example](https://mne.tools/stable/auto_examples/time_frequency/time_frequency_erds.html#sphx-glr-auto-examples-time-frequency-time-frequency-erds-py), and see if the results are same or not?

Cheers,

---

<div class="post-metadata">

**Author:** ![bonokat](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/bonokat/32/1901_2.png) [@bonokat](https://mne.discourse.group/u/bonokat)\
**Post date:** [May 8, 2025, 1:03am UTC](https://mne.discourse.group/t/cluster-permutation-statistics-for-pac/11138/3 "2025-05-08T01:03:56Z")

</div>

Hey,

Thanks a lot for your reply!

I’ve actually tried to z-score my PAC values and it helped to get more meaningful output.  
I would assume that since the modulation indices were small, almost any difference reached significance level and normalization halped to get rid of this issue.
