Skip to main content

Module array_weights

Module array_weights 

Source
Expand description

limma’s arrayWeights and duplicateCorrelation.

array_weights gives one precision weight per sample, so a bad array is down-weighted everywhere rather than dropped. duplicate_correlation gives the consensus intra-block correlation for a repeated-measures design.

§Array weights

Sample j has variance sigma^2 / w_j with log(1 / w_j) = z_j' gamma, where z_j is a row of the variance design (contr.sum(n_samples) by default, so the log weights sum to zero). Both methods solve the same REML score equations and differ in how they sweep the genes:

  • ArrayWeightMethod::GeneByGene: one Fisher scoring step per gene, weights updated as it goes. One pass, no convergence test, copes with missing values and gene-level weights.
  • ArrayWeightMethod::Reml: score and information accumulated over all genes, iterated to convergence. Needs a complete matrix.

prior_n is a ridge on the information: the number of notional genes that saw every weight equal to one.

§Duplicate correlation

A per-gene two-component mixed model through statmod::mixedModel2Fit, then a trimmed mean of the Fisher z-transformed correlations. The per-gene fit projects out the fixed effects, takes an SVD of the projected block design, and fits a gamma GLM of the squared rotated residuals on the squared singular values. The Levenberg damping of that GLM is reproduced step for step, since the answer depends on where it stops. edgePython uses a one-way ANOVA moment estimator instead. See UPSTREAM_DEVIATIONS.md A14.

§Implementation notes

  • No scalar optimiser: arrayWeights is Fisher scoring with a closed-form step and glmgam.fit is its own damped scoring, so crate::numeric::optimise would stop somewhere else.
  • The dense linear algebra is local: a LINPACK dqrdc2 QR and a partial-pivot elimination, so the rank rule and pivot order are R’s. faer is used only for the SVD in the mixed model.
  • f64 only, not generic. The matrices scale with sample count, so there is no memory to save.

§References

Ritchie, Diyagama, Neilson, van Laar, Dobrovic, Holloway and Smyth, BMC Bioinformatics, 2006 (array weights)

Smyth, Michaud and Scott, Bioinformatics, 2005 (duplicate correlation)

Structs§

ArrayWeightParams
Knobs for array_weights.

Enums§

ArrayWeightMethod
How array_weights sweeps the genes.

Functions§

array_weights
Per-sample quality weights, limma’s arrayWeights.
duplicate_correlation
Consensus intra-block correlation, limma’s duplicateCorrelation.