With a few samples, each gene’s residual variance is a poor estimate: some genes
look precise by chance and give large t-statistics. Empirical Bayes moderation borrows
strength from all genes by shrinking each variance towards a common value Smyth, 2004.
Every test of a linear model in CytePool moderates this way: moderated_statistics
and treat on a fit, and the differential-expression, gene-set and composition
functions inside.
The model¶
The residual variance of gene on degrees of freedom, and the true variance , follow
so that follows times an distribution. The prior is estimated from all genes, and each variance is replaced by its posterior value
The moderated t-statistic , with the
unscaled standard error of the coefficient or contrast, follows a t distribution on
degrees of freedom when the coefficient is zero; its two-sided p-value comes
from the tail of that distribution (t_sf), on fractional degrees of freedom too.
Large means the genes have similar variances and the prior counts for much;
is the ordinary t-test. moderated_statistics returns them in a
ModeratedFit, and squeeze_variances applies the same moderation to any set
of variances (SqueezedVariances).
Estimating the prior¶
Method of moments (
fit_f_distribution, limma’sfitFDist): matches the mean and variance of , corrected for its sampling distribution, to those of the scaled F distribution Smyth, 2004, section 6.2, and returns aFDistributionFit. With a covariate, as in limma-trend, follows a natural cubic spline (natural_spline_basis) in the mean log-expression of the genes Phipson et al., 2016, section 10.1.Robust (
fit_f_distribution_robust,robust=True): Winsorizes the log variances so that hypervariable genes do not lower , and gives outlying genes a smaller prior df of their own Phipson et al., 2016 (RobustFDistributionFit).Weighted moments and profile likelihood (
fit_f_distribution_likelihood, limma’sfitFDistUnequalDF1): for degrees of freedom that differ between genes or are fractional, as with missing values, zero weights, mixed models or the quasi-likelihood of edgeR 4 Chen et al., 2025 (LikelihoodFDistributionFit).
By default the likelihood estimator is used when the positive degrees of freedom differ
between genes and the method of moments otherwise, as in limma since version 3.61.8
(legacy = NULL).
Moderated F and the B-statistic¶
The moderated F-statistic tests that all coefficients of a gene are zero: , with the correlation matrix of the coefficients and its rank. CytePool uses each gene’s own correlation matrix when the fit has one (missing values or observation weights), which is the correct F-statistic [Smyth (2004), section 7]; limma uses the correlation of the unweighted design for every gene.
The B-statistic is the log-odds that a coefficient is non-zero Lönnstedt & Speed, 2002, in the form of Smyth (2004):
with the assumed proportion of non-zero coefficients (0.01 by default), , , the squared unscaled standard error and the prior variance of non-zero coefficients, estimated from the largest t-statistics. When every gene has the same degrees of freedom and unscaled standard error, as in a fit without weights or missing values, B orders the genes as does.
Testing against a fold-change threshold¶
A small p-value says a fold change is not zero, not that it is large. TREAT tests against McCarthy & Smyth, 2009. With the moderated t-statistic , its standard error and , the p-value is the worst case over the null interval,
with on degrees of freedom. treat returns a TreatFit and
takes the threshold as a log2 fold change (lfc) or a fold change (fc, 1.2 by
default, as in limma). Filtering significant genes by their estimated fold change does
not test the threshold; TREAT does, and McCarthy & Smyth (2009) found that it improves on the
false discovery rate of existing methods when the size of the change is taken into
account.
- Smyth, G. K. (2004). Linear models and empirical Bayes methods for assessing differential expression in microarray experiments. Statistical Applications in Genetics and Molecular Biology, 3(1), Article 3. 10.2202/1544-6115.1027
- Phipson, B., Lee, S., Majewski, I. J., Alexander, W. S., & Smyth, G. K. (2016). Robust hyperparameter estimation protects against hypervariable genes and improves power to detect differential expression. The Annals of Applied Statistics, 10(2), 946–963. 10.1214/16-AOAS920
- Chen, Y., Chen, L., Lun, A. T. L., Baldoni, P. L., & Smyth, G. K. (2025). edgeR v4: powerful differential analysis of sequencing data with expanded functionality and improved support for small counts and larger datasets. Nucleic Acids Research, 53(2), gkaf018. 10.1093/nar/gkaf018
- Lönnstedt, I., & Speed, T. P. (2002). Replicated microarray data. Statistica Sinica, 12(1), 31–46.
- McCarthy, D. J., & Smyth, G. K. (2009). Testing significance relative to a fold-change threshold is a TREAT. Bioinformatics, 25(6), 765–771. 10.1093/bioinformatics/btp053