nispace.stats.coloc.pearson
- nispace.stats.coloc.pearson(x, y)[source]
Compute Pearson correlation for two 1D arrays.
- Parameters:
x (np.ndarray, shape (n,), dtype float) – Numba-jitted: must be plain 1D
np.ndarrayinstances of equal length. Does not handle NaN – callers must pre-mask (e.g. x[mask], y[mask]).y (np.ndarray, shape (n,), dtype float) – Numba-jitted: must be plain 1D
np.ndarrayinstances of equal length. Does not handle NaN – callers must pre-mask (e.g. x[mask], y[mask]).
- Returns:
r – NaN if either array has zero variance.
- Return type:
float
Notes
The workhorse of core/colocalize.py’s “pearson”/”spearman” colocalization path (Spearman is computed by ranking with rank2d first, then calling this function on the ranks) and of core/reduce_x.py/core/region_influence.py.