pylimma.select_model

pylimma.select_model(y, design_list, criterion='aic', df_prior=0, s2_prior=None, s2_true=None, **lmfit_kwargs)[source]

Gene-wise model comparison via AIC, BIC, or Mallows’ Cp.

Port of R limma’s selectModel(y, designlist, criterion, df.prior, s2.prior, s2.true, ...) (selmod.R).

Parameters:
  • y (ndarray or DataFrame) – Expression matrix, rows = genes, columns = arrays. No NaNs.

  • design_list (sequence or dict of design matrices) – Collection of candidate design matrices. When a dict is supplied its keys become the model names (matching R’s names(designlist)).

  • criterion ({"aic", "bic", "mallowscp"}, default "aic")

  • df_prior (float, default 0) – Prior degrees of freedom for the variance estimate.

  • s2_prior (float, optional) – Prior variance. Required when df_prior > 0.

  • s2_true (ndarray, optional) – True per-gene variance (required when criterion="mallowscp").

  • **lmfit_kwargs (forwarded to lm_fit().)

Returns:

IC: DataFrame of per-model information criteria. pref: pd.Categorical of preferred model per gene. criterion: the criterion actually used.

Return type:

dict