nispace.stats.coloc.mlr

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

Multiple linear regression of predictor(s) x on target y (via pseudo-inverse).

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 (e.g. x[mask, :], y[mask]).

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

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

  • intercept (bool, default True) – If True, the leading entry of the returned beta array is the fitted intercept; if False, it’s omitted.

Returns:

  • rsq (float) – (Adjusted) R2 of the fit.

  • beta (np.ndarray, shape (n_predictors + 1,) or (n_predictors,)) – Regression coefficients, with or without the leading intercept per intercept.

Notes

Used throughout core/colocalize.py (the “mlr” colocalization method and its per-predictor “individual” R2 drops) and core/region_influence.py (full-model R2 for regional influence).