nispace.stats.coloc.pcr

nispace.stats.coloc.pcr(x, y, adj_r2=True, n_components=inf, **kwargs)[source]

Principal component regression: PCA-reduce x, then regress on y via r2.

Parameters:
  • x (np.ndarray, shape (n_obs, n_predictors)) – Does not handle NaN – sklearn errors on NaN input; pre-mask.

  • y (np.ndarray, shape (n_obs,)) –

  • adj_r2 (bool, default True) – Use adjusted R2 in the underlying r2 fit.

  • n_components (int, default np.inf) – Number of principal components to retain; clipped to n_predictors if larger.

  • **kwargs – Forwarded to sklearn.decomposition.PCA.

Returns:

out{"r2": rsq} – the R2 of y regressed on the retained PCs.

Return type:

dict

Notes

Used by core/colocalize.py’s “pcr” colocalization method, on pre-masked, NaN-free x/y.