How to define adjacency in cluster tests?

The docstring says

If None, a regular lattice adjacency is assumed, connecting each spatial location to its neighbor(s) along the last dimension of X.

Here “regular lattice” means a location is considered adjacent to whatever two locations come immediately before and after it in the input array X. This is usually not what you want with that function, because it expects the last dimension to be sensor / vertex, which can’t be arranged in a simple straight line like time points or frequency bins can.

This other question has more detailed answers that might be useful: Cluster-based permutation on Spatio-spectral data - #3 by drammock

In spatio_temporal_cluster_1samp_test temporal adjacency is handled by the max_step parameter. There is no need to compute an adjacency matrix for time.

1 Like