pylimma.classify_tests_f

pylimma.classify_tests_f(fit, cor_matrix=None, df=inf, p_value=0.01, fstat_only=False)[source]

Use F-tests to classify vectors of t-statistics into outcomes.

This function performs an overall F-test for each gene, and optionally classifies which contrasts are significant using a step-down procedure.

Parameters:
  • fit (dict) – Fit object containing t-statistics and coefficient covariance. Must have keys: ‘t’, and optionally ‘cov_coefficients’, ‘df_prior’, ‘df_residual’.

  • p_value (float, default 0.01) – P-value threshold for significance.

  • fstat_only (bool, default False) – If True, return only the F-statistics (with df1, df2 as attributes). If False, return a classification matrix (-1, 0, 1).

  • cor_matrix (ndarray | None)

  • df (float | ndarray)

Returns:

If fstat_only=True: tuple of (F-statistics, df1, df2) If fstat_only=False: matrix of test results (-1=down, 0=not sig, 1=up)

Return type:

ndarray or tuple

Notes

The F-statistic is computed as a quadratic form in the t-statistics, adjusted for correlation between coefficients. When the coefficients are uncorrelated, this reduces to the mean of squared t-statistics.