Skip to main content

array_weights_quick

Function array_weights_quick 

Source
pub fn array_weights_quick(y: &Array2<f64>, fit: &MArrayLM) -> Array1<f64>
Expand description

arrayWeightsQuick(y, fit): fast approximate array quality weights from an already-fitted model.

For each array j, w_j = 1 / mean_i( e_ij^2 / (s_i^2 (1 - h_j)) ) where e = y - coef %*% t(design) are the residuals, s_i = fit.sigma_i, and h_j is the leverage (hat-matrix diagonal) of design row j. Gene means drop NaN ratios (na.rm = TRUE) but keep Inf ones, so a zero residual variance drives the corresponding weight to 0 — matching limma’s colMeans(..., na.rm = TRUE).

Panics if fit.design is None. Unlike limma this does not warn when the fit carries observation weights (it likewise ignores them).