tedana.stats.fit_model

fit_model(x, y, output_residual=False)[source]

Linear regression for a model y = betas * x + error.

Parameters:
  • x ((T X R) numpy.ndarray) – 2D array with the regressors for the specified model an time

  • y ((T X C) numpy.ndarray) – Time by mixing matrix components for the time series for fitting

  • output_residual (bool) – If true, then this just outputs the residual of the fit. If false, then outputs beta fits, sse, and df

Returns:

  • residual ((T X C) numpy.ndarray) – The residual time series for the fit (only if output_residual is True)

  • betas ((R X C) numpy.ndarray) – The magnitude fits for the model (only if output_residual is False)

  • sse ((C) numpy.ndarray) – The sum of square error for the model (only if output_residual is False)

  • df (int) – The degrees of freeom for the model (only if output_residual is False) (timepoints - number of regressors)