lyman.glm.iterative_ols_fit

lyman.glm.iterative_ols_fit(Y, X)[source]

Fit a linear model using ordinary least squares in each voxel.

The design matrix is expected to be 3D because this function is intended to be used in the context of a prewhitened model, where each voxel has a slightly different (whitened) design.

Parameters
Yn_tp x n_vox array

Time series for each voxel.

Xn_tp x n_ev x n_vox array

Design matrix for each voxel.

Returns
Bn_vox x n_ev array

Parameter estimates at each voxel.

SSn_vox array

Model error summary at each voxel.

XtXinvn_vox x n_ev x n_ev array

The pinv(X’ * X) matrices at each voxel.

En_tp x n_vox array

Residual time series at each voxel.