pylimma.fit_f_dist_unequal_df1
- pylimma.fit_f_dist_unequal_df1(x, df1, covariate=None, span=None, robust=False, prior_weights=None)[source]
Fit scaled F-distribution with unequal df1 values.
Robust estimation of the parameters of a scaled F-distribution when df1 varies substantially between observations. Uses maximum likelihood estimation with inverse-trigamma weighting.
This version is preferred when df1 values are small or vary across genes, such as from edgeR quasi-likelihood pipelines.
- Parameters:
x (array_like) – Sample variances. Should be positive.
df1 (array_like) – Numerator degrees of freedom for each variance (can vary per gene).
covariate (array_like, optional) – If provided, allows the scale to vary as a function of the covariate.
span (float, optional) – LOWESS span for covariate trend. If None, chosen automatically.
robust (bool, default False) – Use FDR-based outlier detection and re-weighting.
prior_weights (array_like, optional) – Prior weights for each observation.
- Returns:
- scalefloat or ndarray
Estimated prior variance (s0^2).
- df2float
Estimated prior degrees of freedom (d0).
- df2_shrunkndarray, optional
Gene-wise shrunken df2 (only if robust=True and outliers found).
- Return type:
Notes
Key differences from fit_f_dist: - Uses inverse-trigamma weighting: w = 1/trigamma(df1/2) - Uses maximum likelihood optimization instead of method of moments - Better handles small or varying df1 values
References
Smyth, G. K. and Chen, L. (2024). limma package source code.