htfa.datasets.regress_confounds

htfa.datasets.regress_confounds(X, confounds)[source]

Remove an intercept, a linear trend and confounds from X.

Ordinary least squares of each voxel on [1, t, confounds] (the regressors standardized), fitted on the samples of X itself.

Parameters:
Xarray of shape (V, T)

Voxel time series.

confoundsarray of shape (T, C)

Confound regressors.

Returns:
array of shape (V, T), float64

The residuals.

Examples

>>> import numpy as np
>>> from htfa.datasets import regress_confounds
>>> X = np.arange(10.0)[None, :] + 3.0
>>> np.allclose(regress_confounds(X, np.zeros((10, 1))), 0)
True