tedana.metrics.external.fit_model_with_stats

fit_model_with_stats(y: ndarray[tuple[int, ...], dtype[_ScalarType_co]], regressor_models: Dict, base_label: str, full_label: str = 'full') Tuple[ndarray[tuple[int, ...], dtype[_ScalarType_co]], ndarray[tuple[int, ...], dtype[_ScalarType_co]], ndarray[tuple[int, ...], dtype[_ScalarType_co]], ndarray[tuple[int, ...], dtype[_ScalarType_co]]][source]

Fit full and partial models and calculate F stats, R2, and p values.

Math from page 11-14 of https://afni.nimh.nih.gov/pub/dist/doc/manual/3dDeconvolve.pdf Calculates Y=betas*X + error for the base and the full model F = ((SSE_base-SSE_full)/(DF_base-DF_full)) / (SSE_full/DF_full) DF = degrees of freedom SSE = sum of squares error

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

  • regressor_models (dict) – Each element in the dictionary is a numpy array defining the regressors in a regressor model. Inclues ‘full’, ‘base’ and partial models.

  • base_label (str) – The base model to compare the full model against. For F stat for the full model, this should be ‘base’. For partial models, this should be the name of the partial model (i.e. “no motion”).

  • full_label (str) – The full model to use. Default=”full”. “full” is expected if the goal is to compare all nuissance regressors to a base model. “task_keep” for the special case of fitting pre-defined task-locked regressors.

Returns:

  • betas_full ((C x R) numpy.ndarray) – The beta fits for the full model (components x regressors)

  • f_vals ((C x M) numpy.ndarray) – The F statistics for the fits to the full and partial models

  • p_vals ((C x M) numpy.ndarray) – The p values for the fits to the full and partial models

  • r2_vals ((C x M) numpy.ndarray) – The R2 statistics for the fits to the full and partial models