Skip to main content

Module predfcm

Module predfcm 

Source
Expand description

Predictive (empirical-Bayes-shrunk) fold changes. Pure-Rust port of limma’s predFCm (Phipson & Smyth).

Given an MArrayLM fit, pred_fcm estimates the proportion of truly differentially expressed genes (1 - propTrueNull), re-runs eBayes at that proportion, fits a gamma intercept to the squared coefficients to get the prior fold-change variance v0, and shrinks each coefficient toward zero by v0 / (v0 + v). When all_de = false the shrunk value is further scaled by the posterior probability of differential expression.

The var_indep_of_fc = false branch reproduces limma’s pmin(v0, 1e-8) clamp verbatim (which forces v0 down to 1e-8), so its output is the same near-zero shrinkage as the reference implementation.

Functions§

pred_fcm
Predictive fold changes for coefficient coef (0-based) of fit. Port of predFCm. method selects the propTrueNull estimator (limma’s default is PropTrueNullMethod::Lfdr); the histogram estimator uses limma’s default of 20 bins. Returns one shrunken fold change per gene.