nispace.stats.misc.residuals

nispace.stats.misc.residuals(x, y, decenter=False)[source]

OLS residuals of y on x (plus intercept).

Numba-compiled; requires plain np.ndarray inputs (no pandas) and does not handle NaN — any NaN in x/y propagates silently through np.linalg.pinv. Dead code on the live pipeline: nothing in NiSpace actually calls this function — every real caller uses the NaN-tolerant residuals_nan() instead.

Parameters:
  • x (numpy.ndarray) – shape (n_values, n_predictors)

  • y (numpy.ndarray) – shape (n_values, 1) or (n_values,)

  • decenter (bool, optional) – add mean of y to residuals before return

Returns:

1D array of residuals w or w/o added mean of y

Return type:

numpy.ndarray