nispace.stats.coloc.r2

nispace.stats.coloc.r2(x, y, adj_r2=True)[source]

R2 of the regression of predictor(s) x on target y (see mlr).

Same fitting procedure as mlr but returns only the R2, without the beta coefficients.

Parameters:
  • x (np.ndarray, shape (n_obs, n_predictors), dtype float) – Numba-jitted: must be a plain 2D np.ndarray. Does not handle NaN – callers must pre-mask.

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

  • adj_r2 (bool, default True) – Return the adjusted (rather than raw) R2.

Returns:

rsq

Return type:

float

Notes

Used by core/colocalize.py’s “slr” (single-predictor) colocalization method, its “mlr” method’s per-predictor “individual” R2 drops, and by dominance (combinatorial R2 over predictor subsets).