Skip to main content

array_weights_prwts_reml

Function array_weights_prwts_reml 

Source
pub fn array_weights_prwts_reml(
    exprs: &Array2<f64>,
    design: &Array2<f64>,
    weights: &Array2<f64>,
    var_design: Option<&Array2<f64>>,
    prior_n: f64,
    maxiter: usize,
    tol: f64,
) -> Array1<f64>
Expand description

Estimate array quality weights by REML with per-observation prior weights (.arrayWeightsPrWtsREML).

The prior-weighted analogue of array_weights: because each gene carries its own observation weights, the weighted design (and hence its QR) differs per gene, so the Fisher information and score are accumulated gene-by-gene rather than computed once and scaled by ngenes. limma reaches this routine from arrayWeights(..., weights=W, method="reml") (the "auto" method sends weighted data to gene-by-gene instead).

Every QR-sign-dependent term enters only through squares or crossprod forms, so the result is independent of the QR column signs and matches R.

  • exprsngenes x narrays expression matrix (no NA/infinite values).
  • designnarrays x p design matrix (assumed full column rank).
  • weightsngenes x narrays positive observation weights.
  • var_design — optional narrays x ngam variance design Z2 whose columns sum to zero; defaults to contr.sum(narrays).
  • prior_n — prior support pulling weights toward 1 (limma default 10).
  • maxiter, tol — Fisher-scoring controls (arrayWeights defaults 50, 1e-5).

Returns a length-narrays vector of array weights.